removal(tests): 删除多个类测试文件并更新常量测试期望值

- 删除抽象类方法调用测试文件 tests/core/classes/abstract.phpt
- 删除抽象类实例化测试文件 tests/core/classes/class_abstract.phpt
- 删除对象克隆测试文件 tests/core/classes/clone_004.phpt
- 更新常量基本测试期望输出,移除未定义属性警告信息
- 重命名构造函数析构函数测试中的变量名 $t 为 $t2
pull/1/head
韩天峰 2 months ago
parent dbcadeb873
commit 57b95e88fd
  1. 34
      tests/core/classes/abstract.phpt
  2. 32
      tests/core/classes/class_abstract.phpt
  3. 83
      tests/core/classes/clone_004.phpt
  4. 2
      tests/core/classes/constants_basic_002.phpt
  5. 3
      tests/core/classes/ctor_dtor.phpt

@ -1,34 +0,0 @@
--TEST--
ZE2 An abstract method may not be called
--FILE--
<?php
abstract class fail {
abstract function show();
}
class pass extends fail {
function show() {
echo "Call to function show()\n";
}
function error() {
parent::show();
}
}
function main() {
$t = new pass();
$t->show();
$t->error();
echo "Done\n"; // shouldn't be displayed
}
?>
--EXPECTF--
Call to function show()
Fatal error: Uncaught Error: Cannot call abstract method fail::show() in %s
Stack trace:
#0 Unknown(0) : %s
#1 {main}
thrown in Unknown(0) : %s

@ -1,32 +0,0 @@
--TEST--
ZE2 An abstract class cannot be instantiated
--FILE--
<?php
abstract class base {
function show() {
echo "base\n";
}
}
class derived extends base {
}
function main() {
$t = new derived();
$t->show();
$t = new base();
$t->show();
echo "Done\n"; // shouldn't be displayed
}
?>
--EXPECTF--
base
Fatal error: Uncaught Error: Cannot instantiate abstract class base in %s:%d
Stack trace:
#0 Unknown(0) : %s
#1 {main}
thrown in %s on line %d

@ -1,83 +0,0 @@
--TEST--
ZE2 object cloning, 4
--FILE--
<?php
abstract class base {
public $a = 'base';
// disallow cloning
private function __clone() {}
}
class test extends base {
public $b = 'test';
// re-enable cloning
public function __clone() {}
public function show() {
var_dump($this);
}
}
function main() {
echo "Original\n";
$o1 = new test;
$o1->a = array(1,2);
$o1->b = array(3,4);
$o1->show();
echo "Clone\n";
$o2 = clone $o1;
$o2->show();
echo "Modify\n";
$o2->a = 5;
$o2->b = 6;
$o2->show();
echo "Done\n";
}
?>
--EXPECT--
Original
object(test)#1 (2) {
["a"]=>
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
["b"]=>
array(2) {
[0]=>
int(3)
[1]=>
int(4)
}
}
Clone
object(test)#2 (2) {
["a"]=>
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
["b"]=>
array(2) {
[0]=>
int(3)
[1]=>
int(4)
}
}
Modify
object(test)#2 (2) {
["a"]=>
int(5)
["b"]=>
int(6)
}
Done

@ -24,8 +24,6 @@ Read class constant.
string(5) "hello"
Fail to read class constant from instance.
Warning: Undefined property: aclass::$myConst in %s on line %d
NULL
Class constant not visible in object var_dump.

@ -24,7 +24,8 @@ function main() {
$t = new early();
$t->__construct();
unset($t);
$t = new late();
$t2 = new late();
//unset($t); delay to end of script
echo "Done\n";

Loading…
Cancel
Save