From 49b664805ccadc165980fa4e10ed9dedf4d4afe8 Mon Sep 17 00:00:00 2001 From: Tom H Anderson Date: Sun, 27 Oct 2024 20:17:15 -0600 Subject: [PATCH] Start an application so we don't need to mock helpers functions --- composer.json | 23 ++++++++----------- phpstan.neon | 2 -- .../Cache/FileCacheProviderTest.php | 2 +- .../Cache/PhpFileCacheProviderTest.php | 2 +- tests/TestCase.php | 12 ++++++++++ tests/helpers.php | 23 ------------------- 6 files changed, 23 insertions(+), 41 deletions(-) delete mode 100644 tests/helpers.php diff --git a/composer.json b/composer.json index b31b5588..e8df54b5 100644 --- a/composer.json +++ b/composer.json @@ -34,21 +34,22 @@ "symfony/cache": "^6.0|^7.0", "symfony/serializer": "^5.0|^6.0|^7.0" }, - "conflict": { - "laravel/lumen": "*" - }, "require-dev": { "doctrine/coding-standard": "^12.0", - "illuminate/log": "^10.0|^11.0", - "illuminate/notifications": "^10.0|^11.0", - "illuminate/queue": "^10.0|^11.0", + "illuminate/log": "^10.0 || ^11.0", + "illuminate/notifications": "^10.0 || ^11.0", + "illuminate/queue": "^10.0 || ^11.0", "mockery/mockery": "^1.6.12", "nikic/php-parser": "^4.19 || ^5.0", "php-parallel-lint/php-parallel-lint": "^1.4", "phpstan/phpstan": "^1.9", "phpstan/phpstan-deprecation-rules": "^1.1", "phpunit/phpunit": "^9.3", - "fakerphp/faker": "^1.23" + "fakerphp/faker": "^1.23", + "laravel/framework": "^10.0 || ^11.0" + }, + "conflict": { + "laravel/lumen": "*" }, "autoload": { "psr-4": { @@ -61,13 +62,7 @@ "autoload-dev": { "psr-4": { "LaravelDoctrineTest\\ORM\\": "tests/" - }, - "files": [ - "tests/helpers.php" - ], - "classmap": [ - "tests" - ] + } }, "suggest": { "fzaninotto/faker": "Required to use the entity factory builder (~1.4).", diff --git a/phpstan.neon b/phpstan.neon index 52021cc8..35123d6c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,4 @@ parameters: level: 0 - bootstrapFiles: - - tests/helpers.php paths: - src diff --git a/tests/Feature/Configuration/Cache/FileCacheProviderTest.php b/tests/Feature/Configuration/Cache/FileCacheProviderTest.php index 842e8259..f2bdeb6e 100644 --- a/tests/Feature/Configuration/Cache/FileCacheProviderTest.php +++ b/tests/Feature/Configuration/Cache/FileCacheProviderTest.php @@ -13,7 +13,7 @@ public function getProvider() { $config = m::mock(Repository::class); $config->shouldReceive('get') - ->with('cache.stores.file.path', 'framework/cache') + ->with('cache.stores.file.path', '/storage/framework/cache') ->once() ->andReturn('/tmp'); diff --git a/tests/Feature/Configuration/Cache/PhpFileCacheProviderTest.php b/tests/Feature/Configuration/Cache/PhpFileCacheProviderTest.php index d1d35436..cdb850f3 100644 --- a/tests/Feature/Configuration/Cache/PhpFileCacheProviderTest.php +++ b/tests/Feature/Configuration/Cache/PhpFileCacheProviderTest.php @@ -13,7 +13,7 @@ public function getProvider() { $config = m::mock(Repository::class); $config->shouldReceive('get') - ->with('cache.stores.file.path', 'framework/cache') + ->with('cache.stores.file.path', '/storage/framework/cache') ->once() ->andReturn('/tmp'); diff --git a/tests/TestCase.php b/tests/TestCase.php index be19364e..1e94d5af 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,8 +2,20 @@ namespace LaravelDoctrineTest\ORM; +use Illuminate\Foundation\Application; use PHPUnit\Framework\TestCase as PHPUnitTestCase; class TestCase extends PHPUnitTestCase { + private Application $application; + + protected function setUp(): void + { + $this->application = new Application(); + } + + protected function tearDown(): void + { + unset($this->application); + } } diff --git a/tests/helpers.php b/tests/helpers.php deleted file mode 100644 index 91b15d6b..00000000 --- a/tests/helpers.php +++ /dev/null @@ -1,23 +0,0 @@ -