-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some error handling test changes, as changes to the $handle property are now detected earlier.
- Loading branch information
Showing
6 changed files
with
51 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 0 additions & 65 deletions
65
ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt
This file was deleted.
Oops, something went wrong.
58 changes: 15 additions & 43 deletions
58
ext/standard/tests/directory/DirectoryClass_error_001.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,27 @@ | ||
--TEST-- | ||
Directory class behaviour. | ||
Changing Directory::$handle property | ||
--FILE-- | ||
<?php | ||
|
||
echo "\n--> Try all methods with bad handle:\n"; | ||
$d = new Directory(getcwd()); | ||
$d->handle = "Havoc!"; | ||
$d = dir(getcwd()); | ||
try { | ||
var_dump($d->read()); | ||
} catch (TypeError $e) { | ||
$d->handle = "Havoc!"; | ||
} catch (Error $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
try { | ||
var_dump($d->rewind()); | ||
} catch (TypeError $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
try { | ||
var_dump($d->close()); | ||
} catch (TypeError $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
|
||
echo "\n--> Try all methods with no handle:\n"; | ||
$d = new Directory(getcwd()); | ||
unset($d->handle); | ||
var_dump($d->handle); | ||
|
||
$d = dir(getcwd()); | ||
try { | ||
var_dump($d->read()); | ||
} catch (\Error $e) { | ||
echo $e->getMessage() . "\n"; | ||
} | ||
try { | ||
var_dump($d->rewind()); | ||
} catch (\Error $e) { | ||
echo $e->getMessage() . "\n"; | ||
} | ||
try { | ||
var_dump($d->close()); | ||
} catch (\Error $e) { | ||
echo $e->getMessage() . "\n"; | ||
unset($d->handle); | ||
} catch (Error $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
var_dump($d->handle); | ||
|
||
?> | ||
--EXPECT-- | ||
--> Try all methods with bad handle: | ||
Directory::read(): supplied argument is not a valid Directory resource | ||
Directory::rewind(): supplied argument is not a valid Directory resource | ||
Directory::close(): supplied argument is not a valid Directory resource | ||
|
||
--> Try all methods with no handle: | ||
Unable to find my handle property | ||
Unable to find my handle property | ||
Unable to find my handle property | ||
--EXPECTF-- | ||
Cannot modify readonly property Directory::$handle | ||
resource(%d) of type (stream) | ||
Cannot unset readonly property Directory::$handle | ||
resource(%d) of type (stream) |