diff --git a/Classes/Tests/UnitTestCase.php b/Classes/Tests/UnitTestCase.php index a10a83a..5facae7 100644 --- a/Classes/Tests/UnitTestCase.php +++ b/Classes/Tests/UnitTestCase.php @@ -51,22 +51,6 @@ protected function setUp() ]); } - protected function configureMockedTranslationService() - { - $translationService = $this->getMockBuilder(TranslationService::class)->getMock(); - $translationService->expects($this->any()) - ->method('translateFinisherOption') - ->willReturnCallback(function ($formRuntime, $finisherIdentifier, $optionKey, $optionValue) { - return $optionValue; - }); - $objectManager = $this->getMockBuilder(ObjectManager::class)->getMock(); - $objectManager->expects($this->any()) - ->method('get') - ->with(TranslationService::class) - ->willReturn($translationService); - GeneralUtility::setSingletonInstance(ObjectManager::class, $objectManager); - } - public function tearDown() { GeneralUtility::resetSingletonInstances($this->singletonInstances); diff --git a/Makefile b/Makefile index f0faf2e..077a471 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ install: clean lint: find . -name \*.php -not -path "./vendor/*" -not -path "./.Build/*" | parallel --gnu php -d display_errors=stderr -l {} > /dev/null \; .Build/bin/phpcs + .Build/bin/phpstan analyze -c phpstan.dist.neon --level=max Classes/ Tests/ *.php unitTests: TYPO3_PATH_WEB=$(TYPO3_WEB_DIR) \ diff --git a/composer.json b/composer.json index 8ef86e2..fe0c931 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,11 @@ "Codappix\\CdxLogging\\": "Classes" } }, + "autoload-dev": { + "psr-4": { + "Codappix\\CdxLogging\\Tests\\": "Tests" + } + }, "require": { "php": ">=7.0", "typo3/cms": "~8.7" @@ -26,7 +31,9 @@ "typo3-ci/typo3cms": "^6.2", "phpunit/phpunit": "~6.2.0", "typo3/testing-framework": "~1.1.0", - "mikey179/vfsStream": "~1.6.4" + "mikey179/vfsStream": "~1.6.4", + "phpstan/phpstan": "~0.9.2", + "saschaegerer/phpstan-typo3": "~0.9.0@dev" }, "config": { "vendor-dir": ".Build/vendor", diff --git a/phpstan.dist.neon b/phpstan.dist.neon new file mode 100644 index 0000000..3f16337 --- /dev/null +++ b/phpstan.dist.neon @@ -0,0 +1,7 @@ +includes: + - .Build/vendor/saschaegerer/phpstan-typo3/extension.neon + +parameters: + ignoreErrors: + - '#Undefined variable: \$_EXTKEY#' + - '#Codappix\\CdxLogging\\Log\\Writer\\Console::__construct\(\) does not call parent constructor from TYPO3\\CMS\\Core\\Log\\Writer\\AbstractWriter\.#'