-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #170 from kagg-design/php-8.4
Fix PHP 8.4 deprecation.
- Loading branch information
Showing
3 changed files
with
55 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
composer.lock | ||
tests/cache | ||
vendor/ | ||
composer.phar | ||
.DS_Store | ||
|
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--TEST-- | ||
Test getCachedPath function (https://github.com/antecedent/patchwork/pull/170) | ||
|
||
--FILE-- | ||
<?php | ||
|
||
require __DIR__ . "/../Patchwork.php"; | ||
|
||
use Patchwork\CodeManipulation\Stream; | ||
|
||
$cachePath = str_replace('\\', '/', __DIR__ . '/cache'); | ||
Patchwork\CodeManipulation\State::$cacheIndexFile = null; | ||
Patchwork\Config\State::$cachePath = $cachePath; | ||
|
||
if ( ! is_dir($cachePath)) { | ||
mkdir($cachePath); | ||
} else { | ||
echo "The cache directory should not exist in advance.\n"; | ||
} | ||
|
||
// The expected path depends on the current implementation of getCachedPath(). | ||
$file = 'test-file.php'; | ||
$hash = md5($file); | ||
|
||
$expectedPath = $cachePath . '/' . $hash . '.php'; | ||
|
||
// First pass - index.csv file does not exist. | ||
$actualPath = \Patchwork\CodeManipulation\getCachedPath($file); | ||
|
||
echo $actualPath === $expectedPath ? 'PASS' : 'FAIL'; | ||
echo "\n"; | ||
|
||
// Second pass - index.csv file exists. | ||
$actualPath = \Patchwork\CodeManipulation\getCachedPath($file); | ||
|
||
echo $actualPath === $expectedPath ? 'PASS' : 'FAIL'; | ||
?> | ||
|
||
--CLEAN-- | ||
<?php | ||
|
||
unlink(__DIR__ . '/cache/index.csv'); | ||
rmdir(__DIR__ . '/cache'); | ||
|
||
?> | ||
--EXPECT-- | ||
PASS | ||
PASS |