]> granicus.if.org Git - php/commitdiff
add tests for new E_FATALs
authorAntony Dovgal <tony2001@php.net>
Wed, 31 May 2006 14:55:16 +0000 (14:55 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 31 May 2006 14:55:16 +0000 (14:55 +0000)
Zend/tests/objects_001.phpt [new file with mode: 0644]
Zend/tests/objects_002.phpt [new file with mode: 0644]
Zend/tests/objects_003.phpt [new file with mode: 0644]
Zend/tests/objects_004.phpt [new file with mode: 0644]
Zend/tests/objects_005.phpt [new file with mode: 0644]
Zend/tests/objects_006.phpt [new file with mode: 0644]
Zend/tests/objects_007.phpt [new file with mode: 0644]
Zend/tests/objects_008.phpt [new file with mode: 0644]
Zend/tests/objects_009.phpt [new file with mode: 0644]

diff --git a/Zend/tests/objects_001.phpt b/Zend/tests/objects_001.phpt
new file mode 100644 (file)
index 0000000..5cdc3dd
--- /dev/null
@@ -0,0 +1,60 @@
+--TEST--
+comparing objects to other types
+--FILE--
+<?php
+
+class Bar {
+}
+
+$b = new Bar;
+
+var_dump($b == NULL);
+var_dump($b != NULL);
+var_dump($b == true);
+var_dump($b != true);
+var_dump($b == false);
+var_dump($b != false);
+var_dump($b == "");
+var_dump($b != "");
+var_dump($b == 0);
+var_dump($b != 0);
+var_dump($b == 1);
+var_dump($b != 1);
+var_dump($b == 1.0);
+var_dump($b != 1.0);
+var_dump($b == 1);
+
+
+echo "Done\n";
+?>
+--EXPECTF--    
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+
+Notice: Object of class Bar could not be converted to int in %s on line %d
+bool(false)
+
+Notice: Object of class Bar could not be converted to int in %s on line %d
+bool(true)
+
+Notice: Object of class Bar could not be converted to int in %s on line %d
+bool(true)
+
+Notice: Object of class Bar could not be converted to int in %s on line %d
+bool(false)
+
+Notice: Object of class Bar could not be converted to double in %s on line %d
+bool(true)
+
+Notice: Object of class Bar could not be converted to double in %s on line %d
+bool(false)
+
+Notice: Object of class Bar could not be converted to int in %s on line %d
+bool(true)
+Done
diff --git a/Zend/tests/objects_002.phpt b/Zend/tests/objects_002.phpt
new file mode 100644 (file)
index 0000000..ac79e8d
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+method overloading with different method signature
+--INI--
+error_reporting=8191
+--FILE--
+<?php
+
+class test {
+       function foo() {}
+}
+
+class test2 extends test {
+       function foo() {} 
+}
+
+class test3 extends test {
+       function foo($arg) {} 
+}
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Fatal error: Declaration of test3::foo() must be compatible with that of test::foo() in %s on line %d
diff --git a/Zend/tests/objects_003.phpt b/Zend/tests/objects_003.phpt
new file mode 100644 (file)
index 0000000..9041e30
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+method overloading with different method signature
+--INI--
+error_reporting=8191
+--FILE--
+<?php
+
+class test {
+       function foo($arg) {}
+}
+
+class test2 extends test {
+       function foo($arg) {} 
+}
+
+class test3 extends test {
+       function foo($arg, $arg2) {} 
+}
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Fatal error: Declaration of test3::foo() must be compatible with that of test::foo() in %s on line %d
diff --git a/Zend/tests/objects_004.phpt b/Zend/tests/objects_004.phpt
new file mode 100644 (file)
index 0000000..14620c1
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+method overloading with different method signature
+--INI--
+error_reporting=8191
+--FILE--
+<?php
+
+class test {
+       function foo($arg) {}
+}
+
+class test2 extends test {
+       function foo($arg) {} 
+}
+
+class test3 extends test {
+       function foo(&$arg) {} 
+}
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Fatal error: Declaration of test3::foo() must be compatible with that of test::foo() in %s on line %d
diff --git a/Zend/tests/objects_005.phpt b/Zend/tests/objects_005.phpt
new file mode 100644 (file)
index 0000000..d4ab869
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+method overloading with different method signature
+--INI--
+error_reporting=8191
+--FILE--
+<?php
+
+class test {
+       function &foo() {}
+}
+
+class test2 extends test {
+       function &foo() {} 
+}
+
+class test3 extends test {
+       function foo() {} 
+}
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Fatal error: Declaration of test3::foo() must be compatible with that of test::foo() in %s on line %d
diff --git a/Zend/tests/objects_006.phpt b/Zend/tests/objects_006.phpt
new file mode 100644 (file)
index 0000000..67f43c3
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+method overloading with different method signature
+--INI--
+error_reporting=8191
+--FILE--
+<?php
+
+class test {
+       function foo($arg, $arg2 = NULL) {}
+}
+
+class test2 extends test {
+       function foo($arg, $arg2 = NULL) {} 
+}
+
+class test3 extends test {
+       function foo($arg, $arg2) {} 
+}
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Fatal error: Declaration of test3::foo() must be compatible with that of test::foo() in %s on line %d
diff --git a/Zend/tests/objects_007.phpt b/Zend/tests/objects_007.phpt
new file mode 100644 (file)
index 0000000..21e07c0
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+method overloading with different method signature
+--INI--
+error_reporting=8191
+--FILE--
+<?php
+
+class test {
+       function foo($arg, &$arg2 = NULL) {}
+}
+
+class test2 extends test {
+       function foo($arg, &$arg2 = NULL) {} 
+}
+
+class test3 extends test {
+       function foo($arg, &$arg2) {} 
+}
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Fatal error: Declaration of test3::foo() must be compatible with that of test::foo() in %s on line %d
diff --git a/Zend/tests/objects_008.phpt b/Zend/tests/objects_008.phpt
new file mode 100644 (file)
index 0000000..49ad42d
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+method overloading with different method signature
+--INI--
+error_reporting=8191
+--FILE--
+<?php
+
+class test {
+       function foo(Test $arg) {}
+}
+
+class test2 extends test {
+       function foo(Test $arg) {} 
+}
+
+class test3 extends test {
+       function foo(Test3 $arg) {} 
+}
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Fatal error: Declaration of test3::foo() must be compatible with that of test::foo() in %s on line %d
diff --git a/Zend/tests/objects_009.phpt b/Zend/tests/objects_009.phpt
new file mode 100644 (file)
index 0000000..67611f1
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+method overloading with different method signature
+--INI--
+error_reporting=8191
+--FILE--
+<?php
+
+class test {
+       function foo(Test $arg) {}
+}
+
+class test2 extends test {
+       function foo(Test $arg) {} 
+}
+
+class test3 extends test {
+       function foo($arg) {} 
+}
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Fatal error: Declaration of test3::foo() must be compatible with that of test::foo() in %s on line %d