summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2015-03-31 16:10:06 +0200
committerNikita Popov <nikic@php.net>2015-03-31 17:55:27 +0200
commit6ef9216269c0a42898feed90cec9fc4193cad9b6 (patch)
tree768aff67da6c219c49b34b727d4a109e149be614 /tests
parentdb76b708cf14ed2794d26600c0e49df8aa36fbea (diff)
downloadphp-git-6ef9216269c0a42898feed90cec9fc4193cad9b6.tar.gz
Finish PHP 4 constructor deprecation
Diffstat (limited to 'tests')
-rw-r--r--tests/classes/ctor_name_clash.phpt1
-rw-r--r--tests/classes/final_ctor1.phpt1
-rw-r--r--tests/classes/final_ctor2.phpt1
-rw-r--r--tests/classes/final_ctor3.phpt2
-rw-r--r--tests/classes/inheritance_002.phpt19
-rw-r--r--tests/classes/inheritance_005.phpt1
-rw-r--r--tests/classes/inheritance_007.phpt1
-rw-r--r--tests/lang/bug27535.phpt2
8 files changed, 20 insertions, 8 deletions
diff --git a/tests/classes/ctor_name_clash.phpt b/tests/classes/ctor_name_clash.phpt
index 1a1d6fa511..e6518775ff 100644
--- a/tests/classes/ctor_name_clash.phpt
+++ b/tests/classes/ctor_name_clash.phpt
@@ -18,5 +18,6 @@ $obj = new derived();
$obj->base();
?>
--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; base has a deprecated constructor in %s on line %d
base::base
derived::base
diff --git a/tests/classes/final_ctor1.phpt b/tests/classes/final_ctor1.phpt
index ebfa08081e..acf20918fd 100644
--- a/tests/classes/final_ctor1.phpt
+++ b/tests/classes/final_ctor1.phpt
@@ -25,5 +25,6 @@ ReflectionClass::export('Extended');
?>
--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Extended has a deprecated constructor in %s on line %d
Fatal error: Cannot override final Base::__construct() with Extended::Extended() in %sfinal_ctor1.php on line %d
diff --git a/tests/classes/final_ctor2.phpt b/tests/classes/final_ctor2.phpt
index 905337b408..37fcac29a9 100644
--- a/tests/classes/final_ctor2.phpt
+++ b/tests/classes/final_ctor2.phpt
@@ -25,5 +25,6 @@ ReflectionClass::export('Extended');
?>
--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base has a deprecated constructor in %s on line %d
Fatal error: Cannot override final Base::Base() with Extended::__construct() in %sfinal_ctor2.php on line %d
diff --git a/tests/classes/final_ctor3.phpt b/tests/classes/final_ctor3.phpt
index 3a61ecf902..b34996c979 100644
--- a/tests/classes/final_ctor3.phpt
+++ b/tests/classes/final_ctor3.phpt
@@ -10,4 +10,6 @@ Ensure implicit final inherited old-style constructor cannot be overridden.
}
?>
--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
+
Fatal error: Cannot override final method A::A() in %s on line %d
diff --git a/tests/classes/inheritance_002.phpt b/tests/classes/inheritance_002.phpt
index 0b8cf2650e..7669f735e5 100644
--- a/tests/classes/inheritance_002.phpt
+++ b/tests/classes/inheritance_002.phpt
@@ -17,13 +17,13 @@ class Child_php4 extends Base_php4 {
}
}
-class Base_php7 {
+class Base_php5 {
function __construct() {
var_dump('Base constructor');
}
}
-class Child_php7 extends Base_php7 {
+class Child_php5 extends Base_php5 {
function __construct() {
var_dump('Child constructor');
parent::__construct();
@@ -37,7 +37,7 @@ class Child_mx1 extends Base_php4 {
}
}
-class Child_mx2 extends Base_php7 {
+class Child_mx2 extends Base_php5 {
function Child_mx2() {
var_dump('Child constructor');
parent::__construct();
@@ -47,8 +47,8 @@ class Child_mx2 extends Base_php7 {
echo "### PHP 4 style\n";
$c4= new Child_php4();
-echo "### PHP 7 style\n";
-$c5= new Child_php7();
+echo "### PHP 5 style\n";
+$c5= new Child_php5();
echo "### Mixed style 1\n";
$cm= new Child_mx1();
@@ -56,11 +56,16 @@ $cm= new Child_mx1();
echo "### Mixed style 2\n";
$cm= new Child_mx2();
?>
---EXPECT--
+--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base_php4 has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Child_php4 has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Child_mx2 has a deprecated constructor in %s on line %d
### PHP 4 style
string(17) "Child constructor"
string(16) "Base constructor"
-### PHP 7 style
+### PHP 5 style
string(17) "Child constructor"
string(16) "Base constructor"
### Mixed style 1
diff --git a/tests/classes/inheritance_005.phpt b/tests/classes/inheritance_005.phpt
index 8990264d92..7399bf1168 100644
--- a/tests/classes/inheritance_005.phpt
+++ b/tests/classes/inheritance_005.phpt
@@ -41,6 +41,7 @@ Check for inherited old-style constructor.
var_dump(is_callable(array($c, "C")));
?>
--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
About to construct new B:
In A::A
Is B::B() callable?
diff --git a/tests/classes/inheritance_007.phpt b/tests/classes/inheritance_007.phpt
index 46100449c4..c87fbde344 100644
--- a/tests/classes/inheritance_007.phpt
+++ b/tests/classes/inheritance_007.phpt
@@ -18,6 +18,7 @@ $b->b();
?>
--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
array(2) {
[0]=>
object(ReflectionMethod)#%d (2) {
diff --git a/tests/lang/bug27535.phpt b/tests/lang/bug27535.phpt
index a6ceae7463..29fd033469 100644
--- a/tests/lang/bug27535.phpt
+++ b/tests/lang/bug27535.phpt
@@ -12,7 +12,7 @@ class Class2
{
public $storage = '';
- function Class2()
+ function __construct()
{
$this->storage = new Class1();