From fbf60bd9c23578c10739f2341d4b19fc645a4851 Mon Sep 17 00:00:00 2001 From: chaz6chez Date: Sat, 6 May 2023 10:34:44 +0800 Subject: [PATCH] =?UTF-8?q?updated=EF=BC=9A=201.=20modified=20CI.yml=202.?= =?UTF-8?q?=20modified=20BaseTestCase.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CI.yml | 2 +- .gitignore | 3 +-- composer.json | 2 +- phpunit.xml | 5 ++--- tests/.gitignore | 2 ++ tests/BaseTestCase.php | 8 ++++---- 6 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 tests/.gitignore diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ff960a1..3af6b75 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -21,7 +21,7 @@ jobs: with: php-version: ${{ matrix.php }} extensions: pcntl, posix - tools: phpunit:10, composer:v2 + tools: phpunit:9, composer:v2 coverage: none - run: composer install - run: vendor/bin/phpunit diff --git a/.gitignore b/.gitignore index a0caa65..3065d6d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ /.idea /.vscode /vendor -/tests/cache composer.lock identifier.sqlite -.phpunit.cache \ No newline at end of file +.phpunit.result.cache \ No newline at end of file diff --git a/composer.json b/composer.json index 7029b8d..4993745 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ }, "require-dev": { "symfony/var-dumper": "^5.0 | ^6.0", - "phpunit/phpunit": "^9.0 | ^10.0" + "phpunit/phpunit": "^9.0" }, "autoload": { "psr-4": { diff --git a/phpunit.xml b/phpunit.xml index 5327aa9..1d74eb8 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,13 +1,12 @@ diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..0e3dc9c --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,2 @@ +*.cache +!.gitignore \ No newline at end of file diff --git a/tests/BaseTestCase.php b/tests/BaseTestCase.php index d2968d8..83a9c0e 100644 --- a/tests/BaseTestCase.php +++ b/tests/BaseTestCase.php @@ -39,7 +39,7 @@ public function runtime(bool $reset = false): ?Runtime */ public function write(string $file, string $content): void { - file_put_contents(__DIR__ . '/cache/' . $file . '.cache', $content, FILE_APPEND|LOCK_EX); + file_put_contents(__DIR__ . "/$file.cache", $content, FILE_APPEND|LOCK_EX); } /** @@ -48,7 +48,7 @@ public function write(string $file, string $content): void */ public function read(string $file): string { - if(file_exists($file = __DIR__ . '/cache/' . $file . '.cache')){ + if(file_exists($file = __DIR__ . "/$file.cache")){ return trim(file_get_contents($file)); } throw new \RuntimeException('Cache Not Found : ' . $file); @@ -59,7 +59,7 @@ public function read(string $file): string */ public function removeAllCaches() { - array_map('unlink', glob( __DIR__ . '/cache/*.cache')); + array_map('unlink', glob( __DIR__ . '/*.cache')); } /** @@ -67,7 +67,7 @@ public function removeAllCaches() */ public function removeCache(string $file) { - if(file_exists($file = __DIR__ . '/cache/' . $file . '.cache')){ + if(file_exists($file = __DIR__ . "/$file.cache")){ @unlink($file); } }