Skip to content

Commit

Permalink
Split the failing #138 test into 2 cases
Browse files Browse the repository at this point in the history
  • Loading branch information
antecedent committed Feb 15, 2023
1 parent aa07fc1 commit 923f940
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
--TEST--
https://github.com/antecedent/patchwork/issues/138
Case 1/2: the other stream wrapper is registered AFTER importing Patchwork.

--FILE--
<?php
Expand All @@ -10,10 +11,11 @@ error_reporting(E_ALL | E_STRICT);

require __DIR__ . "/includes/StreamWrapperForTesting.php";

require __DIR__ . "/../Patchwork.php";

stream_wrapper_unregister('file');
stream_wrapper_register('file', 'StreamWrapperForTesting');

require __DIR__ . "/../Patchwork.php";
require __DIR__ . "/includes/Functions.php";

Patchwork\redefine('getInteger', function() {
Expand Down
32 changes: 32 additions & 0 deletions tests/other-stream-wrapper-before.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--TEST--
https://github.com/antecedent/patchwork/issues/138
Case 2/2: the other stream wrapper is registered BEFORE importing Patchwork.

--FILE--
<?php

assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_WARNING, 1);
error_reporting(E_ALL | E_STRICT);

require __DIR__ . "/includes/StreamWrapperForTesting.php";

stream_wrapper_unregister('file');
stream_wrapper_register('file', 'StreamWrapperForTesting');

require __DIR__ . "/../Patchwork.php";
require __DIR__ . "/includes/Functions.php";

Patchwork\redefine('getInteger', function() {
return 1;
});

assert(getInteger() === 1);

assert(in_array('Functions.php', StreamWrapperForTesting::$pathsOpened));

?>
===DONE===

--EXPECT--
===DONE===

0 comments on commit 923f940

Please sign in to comment.