1--TEST-- 2Directory class behaviour. 3--FILE-- 4<?php 5 6$d = getcwd().PATH_SEPARATOR."私はガラスを食べられます"; 7 8mkdir($d); 9 10echo "\n--> Try all methods with bad handle:\n"; 11$d = new Directory($d); 12$d->handle = "Havoc!"; 13try { 14 var_dump($d->read()); 15} catch (TypeError $e) { 16 echo $e->getMessage(), "\n"; 17} 18try { 19 var_dump($d->rewind()); 20} catch (TypeError $e) { 21 echo $e->getMessage(), "\n"; 22} 23try { 24 var_dump($d->close()); 25} catch (TypeError $e) { 26 echo $e->getMessage(), "\n"; 27} 28 29echo "\n--> Try all methods with no handle:\n"; 30$d = new Directory($d); 31unset($d->handle); 32 33try { 34 var_dump($d->read()); 35} catch (\Error $e) { 36 echo $e->getMessage() . "\n"; 37} 38try { 39 var_dump($d->rewind()); 40} catch (\Error $e) { 41 echo $e->getMessage() . "\n"; 42} 43try { 44 var_dump($d->close()); 45} catch (\Error $e) { 46 echo $e->getMessage() . "\n"; 47} 48 49?> 50--CLEAN-- 51<?php 52$d = getcwd().PATH_SEPARATOR."私はガラスを食べられます"; 53rmdir($d); 54 55?> 56--EXPECT-- 57--> Try all methods with bad handle: 58Directory::read(): supplied argument is not a valid Directory resource 59Directory::rewind(): supplied argument is not a valid Directory resource 60Directory::close(): supplied argument is not a valid Directory resource 61 62--> Try all methods with no handle: 63Unable to find my handle property 64Unable to find my handle property 65Unable to find my handle property 66