diff options
| author | Nikita Popov <nikic@php.net> | 2016-05-02 11:42:06 +0200 |
|---|---|---|
| committer | Nikita Popov <nikic@php.net> | 2016-05-02 11:43:01 +0200 |
| commit | 4b0f9586db3d74e5c3228311f4fece7f77ccb898 (patch) | |
| tree | fecbd63ac3d1a2a9b37088d7a74333a1cbdebd26 /ext/reflection/tests | |
| parent | d59d8c9dc648c53b2fe62a712524ed6c0a5231eb (diff) | |
| download | php-git-4b0f9586db3d74e5c3228311f4fece7f77ccb898.tar.gz | |
Add missing update_constants in ReflectionClassConstant
Also fix indentation of __toString().
Diffstat (limited to 'ext/reflection/tests')
| -rw-r--r-- | ext/reflection/tests/ReflectionClassConstant_basic1.phpt | 24 | ||||
| -rw-r--r-- | ext/reflection/tests/ReflectionClassConstant_getValue.phpt | 47 |
2 files changed, 59 insertions, 12 deletions
diff --git a/ext/reflection/tests/ReflectionClassConstant_basic1.phpt b/ext/reflection/tests/ReflectionClassConstant_basic1.phpt index 3d4f49f144..fd8118650f 100644 --- a/ext/reflection/tests/ReflectionClassConstant_basic1.phpt +++ b/ext/reflection/tests/ReflectionClassConstant_basic1.phpt @@ -53,13 +53,13 @@ reflectClassConstant($instance, "BAD_CONST"); Reflecting on class constant TestClass::PUB __toString(): -string(42) " Constant [ public boolean PUB ] { 1 } +string(38) "Constant [ public boolean PUB ] { 1 } " export(): -string(42) " Constant [ public boolean PUB ] { 1 } +string(38) "Constant [ public boolean PUB ] { 1 } " export(): - Constant [ public boolean PUB ] { 1 } +Constant [ public boolean PUB ] { 1 } NULL getName(): @@ -87,13 +87,13 @@ string(21) "/** My Doc comment */" Reflecting on class constant TestClass::PROT __toString(): -string(46) " Constant [ protected integer PROT ] { 4 } +string(42) "Constant [ protected integer PROT ] { 4 } " export(): -string(46) " Constant [ protected integer PROT ] { 4 } +string(42) "Constant [ protected integer PROT ] { 4 } " export(): - Constant [ protected integer PROT ] { 4 } +Constant [ protected integer PROT ] { 4 } NULL getName(): @@ -121,13 +121,13 @@ string(26) "/** Another doc comment */" Reflecting on class constant TestClass::PRIV __toString(): -string(49) " Constant [ private string PRIV ] { keepOut } +string(45) "Constant [ private string PRIV ] { keepOut } " export(): -string(49) " Constant [ private string PRIV ] { keepOut } +string(45) "Constant [ private string PRIV ] { keepOut } " export(): - Constant [ private string PRIV ] { keepOut } +Constant [ private string PRIV ] { keepOut } NULL getName(): @@ -155,13 +155,13 @@ bool(false) Reflecting on class constant TestClass::PRIV __toString(): -string(49) " Constant [ private string PRIV ] { keepOut } +string(45) "Constant [ private string PRIV ] { keepOut } " export(): -string(49) " Constant [ private string PRIV ] { keepOut } +string(45) "Constant [ private string PRIV ] { keepOut } " export(): - Constant [ private string PRIV ] { keepOut } +Constant [ private string PRIV ] { keepOut } NULL getName(): diff --git a/ext/reflection/tests/ReflectionClassConstant_getValue.phpt b/ext/reflection/tests/ReflectionClassConstant_getValue.phpt new file mode 100644 index 0000000000..e447d15357 --- /dev/null +++ b/ext/reflection/tests/ReflectionClassConstant_getValue.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test variations of getting constant values +--FILE-- +<?php + +/* Use separate classes to make sure that in-place constant updates don't interfere */ +class A { + const X = self::Y * 2; + const Y = 1; +} +class B { + const X = self::Y * 2; + const Y = 1; +} +class C { + const X = self::Y * 2; + const Y = 1; +} + +var_dump((new ReflectionClassConstant('A', 'X'))->getValue()); +echo new ReflectionClassConstant('B', 'X'); +echo new ReflectionClass('C'); + +?> +--EXPECTF-- +int(2) +Constant [ public integer X ] { 2 } +Class [ <user> class C ] { + @@ %s 12-15 + + - Constants [2] { + Constant [ public integer X ] { 2 } + Constant [ public integer Y ] { 1 } + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [0] { + } +} |
