mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
New tests
This commit is contained in:
parent
9fb3c509e1
commit
62c41d3f1a
42
Zend/tests/class_constants_004.phpt
Normal file
42
Zend/tests/class_constants_004.phpt
Normal file
@ -0,0 +1,42 @@
|
||||
--TEST--
|
||||
Testing constants (normal, namespace, class and interface)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
namespace foo;
|
||||
|
||||
define('foo', 3);
|
||||
|
||||
const foo = 1;
|
||||
|
||||
class foo {
|
||||
const foo = 2;
|
||||
}
|
||||
|
||||
interface Ifoo {
|
||||
const foo = 4;
|
||||
}
|
||||
|
||||
$const = __NAMESPACE__ .'::foo'; // class
|
||||
$const2 = __NAMESPACE__ .'::Ifoo'; // interface
|
||||
|
||||
var_dump( foo,
|
||||
foo::foo,
|
||||
namespace::foo,
|
||||
foo::foo::foo,
|
||||
$const::foo,
|
||||
::foo,
|
||||
constant('foo'),
|
||||
Ifoo::foo
|
||||
);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(1)
|
||||
int(1)
|
||||
int(2)
|
||||
int(2)
|
||||
int(3)
|
||||
int(3)
|
||||
int(4)
|
18
Zend/tests/objects_017.phpt
Normal file
18
Zend/tests/objects_017.phpt
Normal file
@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Testing visibility of object returned by function
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class foo {
|
||||
private $test = 1;
|
||||
}
|
||||
|
||||
function test() {
|
||||
return new foo;
|
||||
}
|
||||
|
||||
test()->test = 2;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot access private property foo::$test in %s on line %d
|
19
Zend/tests/objects_018.phpt
Normal file
19
Zend/tests/objects_018.phpt
Normal file
@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Using the same function name on interface with inheritance
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
interface Itest {
|
||||
function a();
|
||||
}
|
||||
|
||||
interface Itest2 {
|
||||
function a();
|
||||
}
|
||||
|
||||
interface Itest3 extends Itest, Itest2 {
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Can't inherit abstract function Itest2::a() (previously declared abstract in Itest) in %s on line %d
|
Loading…
Reference in New Issue
Block a user