summaryrefslogtreecommitdiff
path: root/ext/reflection/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/reflection/tests')
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt7
-rw-r--r--ext/reflection/tests/ReflectionClass_isIterateable_001.phpt28
-rw-r--r--ext/reflection/tests/ReflectionMethod_constructor_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt5
-rw-r--r--ext/reflection/tests/ReflectionParameter_isDefault.phpt34
-rw-r--r--ext/reflection/tests/bug52854.phpt28
-rw-r--r--ext/reflection/tests/bug53366.phpt25
7 files changed, 111 insertions, 18 deletions
diff --git a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
index f3881c56d..1f5ba432c 100644
--- a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
@@ -64,10 +64,7 @@ foreach ($classes as $class) {
?>
--EXPECTF--
-
-Strict Standards: Redefining already defined constructor for class OldAndNewCtor in %s on line 26
-
-Strict Standards: %s for class NewAndOldCtor in %s on line 31
+Strict Standards: Redefining already defined constructor for class OldAndNewCtor in %s on line %d
Constructor of NewCtor: __construct
Constructor of ExtendsNewCtor: __construct
Constructor of OldCtor: OldCtor
@@ -79,4 +76,4 @@ Constructor of C: C
Constructor of D1: __construct
Constructor of D2: C
No constructor for X
-No constructor for Y \ No newline at end of file
+No constructor for Y
diff --git a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
index 3ece91542..4936413ef 100644
--- a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
@@ -62,13 +62,27 @@ Is ExtendsIteratorAggregateImpl iterable? bool(true)
Is A iterable? bool(false)
Test invalid params:
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
+
+Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 34
+NULL
+
+Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 2 given in %s on line 35
+NULL
+
+Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 36
+NULL
+
+Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 37
+NULL
+
+Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 38
+NULL
+
+Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 39
+NULL
+
+Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 40
+NULL
Test static invocation:
diff --git a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
index dcc6080b4..2a2f02ffe 100644
--- a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
@@ -86,8 +86,6 @@ var_dump($methodInfo->isConstructor());
?>
--EXPECTF--
Strict Standards: Redefining already defined constructor for class OldAndNewCtor in %s on line %d
-
-Strict Standards: %s for class NewAndOldCtor in %s on line %d
New-style constructor:
bool(true)
diff --git a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
index a784f6d9e..5a0c36f9e 100644
--- a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
@@ -64,10 +64,7 @@ foreach ($classes as $class) {
?>
--EXPECTF--
-
-Strict Standards: Redefining already defined constructor for class OldAndNewCtor in %s on line 26
-
-Strict Standards: %s for class NewAndOldCtor in %s on line 31
+Strict Standards: Redefining already defined constructor for class OldAndNewCtor in %s on line %d
Constructor of NewCtor: __construct
Constructor of ExtendsNewCtor: __construct
Constructor of OldCtor: OldCtor
diff --git a/ext/reflection/tests/ReflectionParameter_isDefault.phpt b/ext/reflection/tests/ReflectionParameter_isDefault.phpt
new file mode 100644
index 000000000..657077093
--- /dev/null
+++ b/ext/reflection/tests/ReflectionParameter_isDefault.phpt
@@ -0,0 +1,34 @@
+--TEST--
+ReflectionParameter::isDefault()
+--FILE--
+<?php
+class A {
+public $defprop;
+}
+$a = new A;
+$a->myprop = null;
+
+$ro = new ReflectionObject($a);
+$props = $ro->getProperties();
+$prop1 = $props[0];
+var_dump($prop1->isDefault());
+$prop2 = $props[1];
+var_dump($prop2->isDefault());
+
+var_dump($ro->getProperty('defprop')->isDefault());
+var_dump($ro->getProperty('myprop')->isDefault());
+
+$prop1 = new ReflectionProperty($a, 'defprop');
+$prop2 = new ReflectionProperty($a, 'myprop');
+var_dump($prop1->isDefault());
+var_dump($prop2->isDefault());
+?>
+==DONE==
+--EXPECT--
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+==DONE==
diff --git a/ext/reflection/tests/bug52854.phpt b/ext/reflection/tests/bug52854.phpt
new file mode 100644
index 000000000..255522de5
--- /dev/null
+++ b/ext/reflection/tests/bug52854.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #52854: ReflectionClass::newInstanceArgs does not work for classes without constructors
+--FILE--
+<?php
+class Test {
+}
+$c = new ReflectionClass('Test');
+var_dump(new Test);
+var_dump(new Test());
+var_dump($c->newInstance());
+var_dump($c->newInstanceArgs(array()));
+
+try {
+ var_dump($c->newInstanceArgs(array(1)));
+} catch(ReflectionException $e) {
+ echo $e->getMessage()."\n";
+}
+?>
+--EXPECTF--
+object(Test)#%d (0) {
+}
+object(Test)#%d (0) {
+}
+object(Test)#%d (0) {
+}
+object(Test)#%d (0) {
+}
+Class Test does not have a constructor, so you cannot pass any constructor arguments
diff --git a/ext/reflection/tests/bug53366.phpt b/ext/reflection/tests/bug53366.phpt
new file mode 100644
index 000000000..5fb119d82
--- /dev/null
+++ b/ext/reflection/tests/bug53366.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #53366 (Reflection doesnt get dynamic property value from getProperty())
+--FILE--
+<?php
+
+class UserClass {
+}
+
+$myClass = new UserClass;
+$myClass->id = 1000;
+
+$reflect = new ReflectionObject($myClass);
+
+var_dump($reflect->getProperty('id'));
+var_dump($reflect->getProperty('id')->getValue($myClass));
+
+?>
+--EXPECTF--
+object(ReflectionProperty)#%d (2) {
+ ["name"]=>
+ string(2) "id"
+ ["class"]=>
+ string(9) "UserClass"
+}
+int(1000)