1--TEST-- 2Test ReflectionProperty::export() errors. 3--FILE-- 4<?php 5 6class TestClass { 7} 8 9$a = 5; 10 11echo "Non-existent class:\n"; 12try { 13 ReflectionProperty::export("NonExistentClass", "prop", true); 14} 15catch(Exception $e) { 16 echo $e->getMessage(); 17} 18 19echo "\n\nWrong property parameter type:\n"; 20try { 21 ReflectionProperty::export($a, 'TestClass', false); 22} 23catch(ReflectionException $e) { 24 echo $e->getMessage(); 25} 26 27echo "\n\nNon-existent property:\n"; 28try { 29 ReflectionProperty::export('TestClass', "nonExistentProperty", true); 30} 31catch(Exception $e) { 32 echo $e->getMessage(); 33} 34 35echo "\n\nIncorrect number of args:\n"; 36ReflectionProperty::export(); 37ReflectionProperty::export('TestClass', "nonExistentProperty", true, false); 38 39?> 40--EXPECTF-- 41Non-existent class: 42Class NonExistentClass does not exist 43 44Wrong property parameter type: 45The parameter class is expected to be either a string or an object 46 47Non-existent property: 48Property TestClass::$nonExistentProperty does not exist 49 50Incorrect number of args: 51 52Warning: ReflectionProperty::export() expects at least 2 parameters, 0 given in %s on line %d 53 54Warning: ReflectionProperty::export() expects at most 3 parameters, 4 given in %s on line %d 55