cvs: ZendEngine2 /tests bug45910.phpt constants_007.phpt constants_008.phpt constants_009.phpt inter_007.phpt

[email protected] ("Felipe Pena")
Newsgroups php.zend-engine.cvs
Message-ID <cvsfelipe1219692911@cvsserver>
felipe		Mon Aug 25 19:35:11 2008 UTC

  Added files:                 
    /ZendEngine2/tests	bug45910.phpt constants_007.phpt 
                      	constants_008.phpt constants_009.phpt 
                      	inter_007.phpt 
  Log:
  - New tests
  

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug45910.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug45910.phpt
+++ ZendEngine2/tests/bug45910.phpt
--TEST--
Bug #45910 (Cannot declare self-referencing constant)
--FILE--
<?php

class foo {
	const AAA = 'x';
	const BBB = 'a';
	const CCC = 'a';
	const DDD = self::AAA;

	private static $foo = array(
		self::BBB	=> 'a',
		self::CCC	=> 'b',
		self::DDD	=>  self::AAA
	);
	
	public static function test() {
		self::$foo;
	}
}

foo::test();

print 1;
?>
--EXPECT--
1

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/constants_007.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/constants_007.phpt
+++ ZendEngine2/tests/constants_007.phpt
--TEST--
Testing const names
--FILE--
<?php

const a = 'a';
const A = 'b';


class a {
	const a = 'c';
	const A = 'd';
}

var_dump(a, A, a::a, a::A);

?>
--EXPECT--
unicode(1) "a"
unicode(1) "b"
unicode(1) "c"
unicode(1) "d"

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/constants_008.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/constants_008.phpt
+++ ZendEngine2/tests/constants_008.phpt
--TEST--
Defining constant twice with two different forms
--FILE--
<?php

define('a', 2);
const a = 1;


if (defined('a')) {
	print a;
}

?>
--EXPECTF--
Notice: Constant a already defined in %s on line %d
2

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/constants_009.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/constants_009.phpt
+++ ZendEngine2/tests/constants_009.phpt
--TEST--
Accessing constants inside namespace
--FILE--
<?php

namespace foo::x;

const x = 2;

class x { 
	const x = 1;
}


var_dump(namespace::x, x::x, namespace::x::x);
var_dump(defined('foo::x::x'));

?>
--EXPECT--
int(2)
int(1)
int(1)
bool(true)

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/inter_007.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/inter_007.phpt
+++ ZendEngine2/tests/inter_007.phpt
--TEST--
Trying inherit abstract function twice
--FILE--
<?php

interface d {
	static function B();	
}

interface c {
	function b();	
}

class_alias('c', 'w');

interface a extends d, w { }

?>
--EXPECTF--
Fatal error: Can't inherit abstract function c::B() (previously declared abstract in d) in %s on line %d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.