Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FileMock: fixed opening modes r, w, x
- 'r' fails when mock does not exist - 'w' truncates mock contents - 'x' fails when mock exist
- Loading branch information
Showing
3 changed files
with
201 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,14 @@ $generator->render($output = Tester\FileMock::create('', 'xml')); | |
|
||
$dom = new DOMDocument; | ||
$dom->load($output); | ||
$files = $sorted = iterator_to_array($dom->getElementsByTagName('file'), FALSE); // TRUE crashes on Travis & PHP 5.3.3 | ||
|
||
//$files = $sorted = iterator_to_array($dom->getElementsByTagName('file')); // iterator_to_array() crashes on Travis & PHP 5.3.3 | ||
$files = array(); | ||
foreach ($dom->getElementsByTagName('file') as $node) { | ||
$files[] = $node; | ||
} | ||
|
||
$sorted = $files; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
milo
Author
Member
|
||
usort($sorted, function($a, $b) { | ||
return strcmp($a->getAttribute('name'), $b->getAttribute('name')); | ||
}); | ||
|
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
Why is the foreach better than iterator_to_array?