New tests

This commit is contained in:
Felipe Pena 2008-03-11 15:21:38 +00:00
parent 9fb3c509e1
commit 62c41d3f1a
3 changed files with 79 additions and 0 deletions

View 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)

View 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

View 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