diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b41210bb..4d73448b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,7 +71,7 @@ jobs: phpstan- continue-on-error: true - name: Run PHPStan analysis - run: ./bin/phpstan analyse --no-interaction --no-progress --no-interaction --ansi + run: phpstan analyse --no-interaction --no-progress --no-interaction --ansi atoum: name: Atoum (PHP ${{ matrix.php }}) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 3aa54859..0abdfbad 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -3,32 +3,5 @@ parameters: paths: - src - tests - bootstrapFiles: - - vendor/autoload.php - -# inferPrivatePropertyTypeFromConstructor: true -# symfony: -# containerXmlPath: tests/Fixtures/app/var/cache/test/AppKernelTestDebugContainer.xml -# constantHassers: false -# doctrine: -# objectManagerLoader: tests/Fixtures/app/object-manager.php -# bootstrapFiles: -# - vendor/bin/.phpunit/phpunit/vendor/autoload.php -# # We're aliasing classes for phpunit in this file, it needs to be added here see phpstan/#2194 -# - src/Symfony/Bundle/Test/Constraint/ArraySubset.php -# - tests/Fixtures/app/AppKernel.php -# excludePaths: -# # Symfony config -# - tests/Fixtures/app/config/config_swagger.php -# # Symfony cache -# - tests/Fixtures/app/var/ -# - tests/Fixtures/Symfony/Maker -# # The Symfony Configuration API isn't good enough to be analysed -# - src/Symfony/Bundle/DependencyInjection/Configuration.php -# # Templates for Maker -# - src/Symfony/Maker/Resources/skeleton -# earlyTerminatingMethodCalls: -# PHPUnit\Framework\Constraint\Constraint: -# - fail -# ApiPlatform\Metadata\Resource\ResourceMetadataCollection: -# - handleNotFound + scanDirectories: + - vendor/atoum/stubs/classes diff --git a/tests/units/Context/JsonContext.php b/tests/units/Context/JsonContext.php index fbab773c..1ca2a45e 100644 --- a/tests/units/Context/JsonContext.php +++ b/tests/units/Context/JsonContext.php @@ -10,31 +10,26 @@ class JsonContext extends \atoum { - /** - * @var HttpCallResultPool - */ - private $httpCallResultPool; + private HttpCallResultPool $httpCallResultPool; public function beforeTestMethod($methodName): void { - $this->mockGenerator->orphanize('__construct'); - $httpCallResult = $this->newMockInstance(HttpCallResult::class); - $httpCallResult->getMockController()->getValue = json_encode([ - 'a string node' => 'some string', - 'another string node' => 'some other string', - 'a null node' => null, - 'a true node' => true, - 'a false node' => false, - 'a number node' => 3, - 'an array node' => [ - 'one', - 'two', - 'three', - ], - ]); - - $this->httpCallResultPool = $this->newMockInstance(HttpCallResultPool::class); - $this->httpCallResultPool->getMockController()->getResult = $httpCallResult; + $this->httpCallResultPool = new HttpCallResultPool(); + $this->httpCallResultPool->store( + new HttpCallResult(json_encode([ + 'a string node' => 'some string', + 'another string node' => 'some other string', + 'a null node' => null, + 'a true node' => true, + 'a false node' => false, + 'a number node' => 3, + 'an array node' => [ + 'one', + 'two', + 'three', + ], + ], \JSON_THROW_ON_ERROR)) + ); } public function testTheJsonNodeShouldBeEqualTo(): void