diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 426facd..0f556dd 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -11,6 +11,10 @@ backupGlobals="false" stopOnFailure="false"> + + + + ./src diff --git a/tests/boot.php b/tests/boot.php index e3ad92d..6b1f073 100644 --- a/tests/boot.php +++ b/tests/boot.php @@ -2,8 +2,6 @@ declare(strict_types=1); -// phpcs:disable PSR1 - $testsDir = str_replace('\\', '/', __DIR__); $libDir = dirname($testsDir); $vendorDir = "{$libDir}/vendor"; @@ -17,8 +15,6 @@ putenv('LIB_DIR=' . $libDir); putenv('VENDOR_DIR=' . $vendorDir); -error_reporting(E_ALL); // phpcs:ignore - require_once "{$libDir}/vendor/antecedent/patchwork/Patchwork.php"; if (!defined('PHPUNIT_COMPOSER_INSTALL')) { diff --git a/tests/src/TestCase.php b/tests/src/TestCase.php index f712f06..3136bd4 100644 --- a/tests/src/TestCase.php +++ b/tests/src/TestCase.php @@ -128,16 +128,13 @@ protected function stubServices(string ...$ids): array /** * @param string ...$ids * @return ContainerInterface - * - * phpcs:disable Inpsyde.CodeQuality.NestingLevel */ protected function stubContainer(string ...$ids): ContainerInterface { - // phpcs:enable Inpsyde.CodeQuality.NestingLevel return new class ($this->stubServices(...$ids)) implements ContainerInterface { /** @var array */ - private array $services; // phpcs:ignore + private array $services; /** @param array $services */ public function __construct(array $services) diff --git a/tests/unit/Container/ContainerConfiguratorTest.php b/tests/unit/Container/ContainerConfiguratorTest.php index d583ada..56d0129 100644 --- a/tests/unit/Container/ContainerConfiguratorTest.php +++ b/tests/unit/Container/ContainerConfiguratorTest.php @@ -416,12 +416,9 @@ static function () use (&$called): \B { /** * @test * @runInSeparateProcess - * - * phpcs:disable Inpsyde.CodeQuality.NestingLevel */ public function testExtensionByTypeNested(): void { - // phpcs:enable Inpsyde.CodeQuality.NestingLevel $logs = []; $log = static function (object $object, int ...$nums) use (&$logs): object { foreach ($nums as $num) { diff --git a/tests/unit/Container/ReadOnlyContainerTest.php b/tests/unit/Container/ReadOnlyContainerTest.php index fae2594..6307c2a 100644 --- a/tests/unit/Container/ReadOnlyContainerTest.php +++ b/tests/unit/Container/ReadOnlyContainerTest.php @@ -8,6 +8,7 @@ use Inpsyde\Modularity\Container\ServiceExtensions; use Inpsyde\Modularity\Tests\TestCase; use Psr\Container\ContainerInterface; +use Psr\Container\NotFoundExceptionInterface; class ReadOnlyContainerTest extends TestCase { @@ -27,7 +28,7 @@ public function testBasic(): void */ public function testGetUnknown(): void { - static::expectException(\Exception::class); + static::expectException(NotFoundExceptionInterface::class); $testee = $this->factoryContainer(); $testee->get('unknown'); @@ -125,12 +126,9 @@ public function has(string $id): bool /** * @test - * - * phpcs:disable Inpsyde.CodeQuality.NestingLevel */ public function testFactoriesAndServices(): void { - // phpcs:enable Inpsyde.CodeQuality.NestingLevel $expectedServiceKey = 'service'; $expectedFactoryKey = 'factory'; diff --git a/tests/unit/PackageTest.php b/tests/unit/PackageTest.php index 55785fa..a051faa 100644 --- a/tests/unit/PackageTest.php +++ b/tests/unit/PackageTest.php @@ -5,11 +5,11 @@ namespace Inpsyde\Modularity\Tests\Unit; use Brain\Monkey; +use Inpsyde\Modularity\Module\ExecutableModule; use Inpsyde\Modularity\Module\ExtendingModule; use Inpsyde\Modularity\Module\FactoryModule; use Inpsyde\Modularity\Module\ServiceModule; use Inpsyde\Modularity\Package; -use Inpsyde\Modularity\Module\ExecutableModule; use Inpsyde\Modularity\Properties\Properties; use Inpsyde\Modularity\Tests\TestCase; use Psr\Container\ContainerInterface; @@ -453,12 +453,9 @@ public function testAddModuleFailsAfterBuild(): void /** * @test - * - * phpcs:disable Inpsyde.CodeQuality.NestingLevel */ public function testBuildResolveServices(): void { - // phpcs:enable phpcs:disable Inpsyde.CodeQuality.NestingLevel $module = new class () implements ServiceModule, ExtendingModule, ExecutableModule { public function id(): string @@ -488,7 +485,7 @@ public function extensions(): array 'service' => function (\ArrayObject $current): object { return new class ($current) { - public \ArrayObject $object; // phpcs:ignore + private \ArrayObject $object; public function __construct(\ArrayObject $object) { diff --git a/tests/unit/Properties/BasePropertiesTest.php b/tests/unit/Properties/BasePropertiesTest.php index 6b4b8fb..56fb583 100644 --- a/tests/unit/Properties/BasePropertiesTest.php +++ b/tests/unit/Properties/BasePropertiesTest.php @@ -80,7 +80,7 @@ public static function provideBaseNameData(): \Generator private function factoryBaseProperties( string $baseName, string $basePath, - string $baseUrl = null, + ?string $baseUrl = null, array $properties = [] ): BaseProperties { @@ -89,7 +89,7 @@ private function factoryBaseProperties( public function __construct( string $baseName, string $basePath, - string $baseUrl = null, + ?string $baseUrl = null, array $properties = [] ) { diff --git a/tests/unit/Properties/LibraryPropertiesTest.php b/tests/unit/Properties/LibraryPropertiesTest.php index 30ace60..e3484f9 100644 --- a/tests/unit/Properties/LibraryPropertiesTest.php +++ b/tests/unit/Properties/LibraryPropertiesTest.php @@ -4,8 +4,8 @@ namespace Inpsyde\Modularity\Tests\Unit\Properties; -use Inpsyde\Modularity\Properties\Properties; use Inpsyde\Modularity\Properties\LibraryProperties; +use Inpsyde\Modularity\Properties\Properties; use Inpsyde\Modularity\Tests\TestCase; use org\bovigo\vfs\vfsStream; @@ -16,7 +16,7 @@ class LibraryPropertiesTest extends TestCase */ public function testForLibraryInvalidFile(): void { - $this->expectException(\Exception::class); + $this->expectException(\Throwable::class); LibraryProperties::new('non-existing.file')->basePath(); } diff --git a/tests/unit/Properties/PluginPropertiesTest.php b/tests/unit/Properties/PluginPropertiesTest.php index 23c3523..dc58f98 100644 --- a/tests/unit/Properties/PluginPropertiesTest.php +++ b/tests/unit/Properties/PluginPropertiesTest.php @@ -4,10 +4,10 @@ namespace Inpsyde\Modularity\Tests\Unit\Properties; -use Inpsyde\Modularity\Properties\Properties; +use Brain\Monkey\Functions; use Inpsyde\Modularity\Properties\PluginProperties; +use Inpsyde\Modularity\Properties\Properties; use Inpsyde\Modularity\Tests\TestCase; -use Brain\Monkey\Functions; class PluginPropertiesTest extends TestCase { diff --git a/tests/unit/Properties/ThemePropertiesTest.php b/tests/unit/Properties/ThemePropertiesTest.php index b21dc30..1a4e40e 100644 --- a/tests/unit/Properties/ThemePropertiesTest.php +++ b/tests/unit/Properties/ThemePropertiesTest.php @@ -4,10 +4,10 @@ namespace Inpsyde\Modularity\Tests\Unit\Properties; +use Brain\Monkey\Functions; use Inpsyde\Modularity\Properties\Properties; use Inpsyde\Modularity\Properties\ThemeProperties; use Inpsyde\Modularity\Tests\TestCase; -use Brain\Monkey\Functions; class ThemePropertiesTest extends TestCase {