From f965293da92ffdfee13f5f4f67f6803423bef17d Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Sat, 8 Feb 2020 13:13:47 -0600 Subject: [PATCH] Specify cache locations for build tools --- .gitignore | 1 - composer.json | 8 ++++---- phpunit.xml.dist | 9 +++++---- tests/bootstrap.php | 10 +++++++++- tests/phpstan-tests.neon | 4 ++++ tests/phpstan.neon | 4 ++++ tests/psalm.xml | 18 +++++++++++------- 7 files changed, 37 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 4dfe4c6..c61d5b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -.phpunit.result.cache /build/ /composer.lock /phpcs.xml diff --git a/composer.json b/composer.json index 41b5638..81c1e66 100644 --- a/composer.json +++ b/composer.json @@ -71,11 +71,11 @@ }, "scripts": { "lint": "parallel-lint src tests", - "phpcbf": "phpcbf -vpw", - "phpcs": "phpcs", + "phpcbf": "phpcbf -vpw --cache=build/cache/phpcs.cache", + "phpcs": "phpcs --cache=build/cache/phpcs.cache", "phpstan": [ - "phpstan analyse -c tests/phpstan.neon src --level max --no-progress", - "phpstan analyse -c tests/phpstan-tests.neon tests --level max --no-progress" + "phpstan analyse -c tests/phpstan.neon --no-progress", + "phpstan analyse -c tests/phpstan-tests.neon --no-progress" ], "psalm": "psalm --show-info=false --config=tests/psalm.xml", "phpunit": "phpunit --verbose --colors=always", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 860f0a9..9cd876f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,9 +1,10 @@ + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd" + bootstrap="./tests/bootstrap.php" + cacheResultFile="./build/cache/phpunit.result.cache" + colors="true" + verbose="true"> ./tests diff --git a/tests/bootstrap.php b/tests/bootstrap.php index cb58db3..40eef3f 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -16,9 +16,17 @@ use AspectMock\Kernel; require_once __DIR__ . '/../vendor/autoload.php'; // composer autoload require_once __DIR__ . '/phpstan-bootstrap.php'; +$cacheDir = __DIR__ . '/../build/cache/goaop'; +if (!is_dir($cacheDir)) { + if (mkdir($cacheDir, 0775, true) === false) { + echo "\n[ERROR] Unable to create cache directory at {$cacheDir}\n\n"; + exit(1); + } +} + $kernel = Kernel::getInstance(); $kernel->init([ 'debug' => true, - 'cacheDir' => sys_get_temp_dir(), + 'cacheDir' => $cacheDir, 'includePaths' => [__DIR__ . '/../src'] ]); diff --git a/tests/phpstan-tests.neon b/tests/phpstan-tests.neon index 10e26b4..bfcbaff 100644 --- a/tests/phpstan-tests.neon +++ b/tests/phpstan-tests.neon @@ -1,4 +1,8 @@ parameters: + tmpDir: ../build/cache/phpstan + level: max + paths: + - . autoload_files: - ./phpstan-bootstrap.php checkMissingIterableValueType: false diff --git a/tests/phpstan.neon b/tests/phpstan.neon index 60d4939..0d3c590 100644 --- a/tests/phpstan.neon +++ b/tests/phpstan.neon @@ -1,4 +1,8 @@ parameters: + tmpDir: ../build/cache/phpstan + level: max + paths: + - ../src checkMissingIterableValueType: false reportUnmatchedIgnoredErrors: false autoload_files: diff --git a/tests/psalm.xml b/tests/psalm.xml index 3964807..eb4be33 100644 --- a/tests/psalm.xml +++ b/tests/psalm.xml @@ -1,13 +1,17 @@ - + + + + + +