summaryrefslogtreecommitdiff
path: root/ext/reflection/tests
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2012-05-23 13:50:12 +0800
committerXinchen Hui <laruence@php.net>2012-05-23 13:50:12 +0800
commitdf481764f34b0268025d031a082297edee124c7c (patch)
tree7ba1f750e24e9d817a449fbf4763dd7ec0dce417 /ext/reflection/tests
parent29876c5c29e737158ecfeb32a59b5bfb0607723b (diff)
downloadphp-git-df481764f34b0268025d031a082297edee124c7c.tar.gz
Revert "Implemented FR #61602 Allow access to name of constant used as default value"
This reverts commit 054f3e3ce5af13c2c3a6ccd54f7dc3e2f6cd4f74. See: http://news.php.net/php.cvs/69137 and the author confirmed. Will commit later after the author fixed this then make a new PR. Conflicts: ext/reflection/php_reflection.c
Diffstat (limited to 'ext/reflection/tests')
-rw-r--r--ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt52
-rw-r--r--ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt30
-rw-r--r--ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt25
3 files changed, 0 insertions, 107 deletions
diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt
deleted file mode 100644
index cdd00d2624..0000000000
--- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName()
---FILE--
-<?php
-
-define("CONST_TEST_1", "const1");
-
-function ReflectionParameterTest($test1=array(), $test2 = CONST_TEST_1) {
- echo $test;
-}
-$reflect = new ReflectionFunction('ReflectionParameterTest');
-foreach($reflect->getParameters() as $param) {
- if($param->getName() == 'test1') {
- var_dump($param->isDefaultValueConstant());
- }
- if($param->getName() == 'test2') {
- var_dump($param->isDefaultValueConstant());
- }
- if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) {
- var_dump($param->getDefaultValueConstantName());
- }
-}
-
-class Foo2 {
- const bar = 'Foo2::bar';
-}
-
-class Foo {
- const bar = 'Foo::bar';
-
- public function baz($param1 = self::bar, $param2=Foo2::bar, $param3=CONST_TEST_1) {
- }
-}
-
-$method = new ReflectionMethod('Foo', 'baz');
-$params = $method->getParameters();
-
-foreach ($params as $param) {
- if ($param->isDefaultValueConstant()) {
- var_dump($param->getDefaultValueConstantName());
- }
-}
-?>
-==DONE==
---EXPECT--
-bool(false)
-bool(true)
-string(12) "CONST_TEST_1"
-string(9) "self::bar"
-string(9) "Foo2::bar"
-string(12) "CONST_TEST_1"
-==DONE==
diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt
deleted file mode 100644
index 1ee9e93735..0000000000
--- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName() for namespace
---FILE--
-<?php
-
-namespace ReflectionTestNamespace {
- CONST TEST_CONST_1 = "Test Const 1";
-
- class TestClass {
- const TEST_CONST_2 = "Test Const 2 in class";
- }
-}
-
-namespace {
- function ReflectionParameterTest($test=ReflectionTestNamespace\TestClass::TEST_CONST_2, $test2 = ReflectionTestNamespace\CONST_TEST_1) {
- echo $test;
- }
- $reflect = new ReflectionFunction('ReflectionParameterTest');
- foreach($reflect->getParameters() as $param) {
- if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) {
- echo $param->getDefaultValueConstantName() . "\n";
- }
- }
- echo "==DONE==";
-}
-?>
---EXPECT--
-ReflectionTestNamespace\TestClass::TEST_CONST_2
-ReflectionTestNamespace\CONST_TEST_1
-==DONE==
diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt
deleted file mode 100644
index 984b06efe2..0000000000
--- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-ReflectionParameter::getDefaultValueConstant() should raise exception on non optional parameter
---FILE--
-<?php
-
-define("CONST_TEST_1", "const1");
-
-function ReflectionParameterTest($test, $test2 = CONST_TEST_1) {
- echo $test;
-}
-$reflect = new ReflectionFunction('ReflectionParameterTest');
-foreach($reflect->getParameters() as $param) {
- try {
- echo $param->getDefaultValueConstantName() . "\n";
- }
- catch(ReflectionException $e) {
- echo $e->getMessage() . "\n";
- }
-}
-?>
-==DONE==
---EXPECT--
-Parameter is not optional
-CONST_TEST_1
-==DONE==