diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:39:08 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:39:08 -0400 |
| commit | 993e1866df547532a05ab6db76c9ff5aefc9a3df (patch) | |
| tree | 169d3bde0974235d3cde164786ef6f381a4749a7 /ext/reflection/tests/reflectionProperty_export_error.phpt | |
| parent | 1f589a2bd44ba835ad1b009a5d83abd453724829 (diff) | |
| download | php-upstream/5.2.6.tar.gz | |
Imported Upstream version 5.2.6upstream/5.2.6
Diffstat (limited to 'ext/reflection/tests/reflectionProperty_export_error.phpt')
| -rw-r--r-- | ext/reflection/tests/reflectionProperty_export_error.phpt | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/ext/reflection/tests/reflectionProperty_export_error.phpt b/ext/reflection/tests/reflectionProperty_export_error.phpt new file mode 100644 index 000000000..9351846f6 --- /dev/null +++ b/ext/reflection/tests/reflectionProperty_export_error.phpt @@ -0,0 +1,56 @@ +--TEST-- +Test ReflectionProperty::export() errors. +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class TestClass { +} + +$a = 5; + +echo "Non-existent class:\n"; +try { + ReflectionProperty::export("NonExistentClass", "prop", true); +} +catch(Exception $e) { + echo $e->getMessage(); +} + +echo "\n\nWrong property parameter type:\n"; +try { + ReflectionProperty::export($a, 'TestClass', false); +} +catch(ReflectionException $e) { + echo $e->getMessage(); +} + +echo "\n\nNon-existent property:\n"; +try { + ReflectionProperty::export('TestClass', "nonExistentProperty", true); +} +catch(Exception $e) { + echo $e->getMessage(); +} + +echo "\n\nIncorrect number of args:\n"; +ReflectionProperty::export(); +ReflectionProperty::export('TestClass', "nonExistentProperty", true, false); + +?> +--EXPECTF-- +Non-existent class: +Class NonExistentClass does not exist + +Wrong property parameter type: +The parameter class is expected to be either a string or an object + +Non-existent property: +Property TestClass::$nonExistentProperty does not exist + +Incorrect number of args: + +Warning: ReflectionProperty::export() expects at least 2 parameters, 0 given in %s on line %d + +Warning: ReflectionProperty::export() expects at most 3 parameters, 4 given in %s on line %d |
