Skip to content

Commit 94c891d

Browse files
committed
adapt tests
1 parent a2c3d3d commit 94c891d

10 files changed

+16
-27
lines changed

phpunit.xml.dist

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
backupGlobals="false"
1212
stopOnFailure="false">
1313

14+
<php>
15+
<ini name="error_reporting" value="E_ALL"/>
16+
</php>
17+
1418
<coverage processUncoveredFiles="true">
1519
<include>
1620
<directory suffix=".php">./src</directory>

tests/boot.php

-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
declare(strict_types=1);
44

5-
// phpcs:disable PSR1
6-
75
$testsDir = str_replace('\\', '/', __DIR__);
86
$libDir = dirname($testsDir);
97
$vendorDir = "{$libDir}/vendor";
@@ -17,8 +15,6 @@
1715
putenv('LIB_DIR=' . $libDir);
1816
putenv('VENDOR_DIR=' . $vendorDir);
1917

20-
error_reporting(E_ALL); // phpcs:ignore
21-
2218
require_once "{$libDir}/vendor/antecedent/patchwork/Patchwork.php";
2319

2420
if (!defined('PHPUNIT_COMPOSER_INSTALL')) {

tests/src/TestCase.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,13 @@ protected function stubServices(string ...$ids): array
128128
/**
129129
* @param string ...$ids
130130
* @return ContainerInterface
131-
*
132-
* phpcs:disable Inpsyde.CodeQuality.NestingLevel
133131
*/
134132
protected function stubContainer(string ...$ids): ContainerInterface
135133
{
136-
// phpcs:enable Inpsyde.CodeQuality.NestingLevel
137134
return new class ($this->stubServices(...$ids)) implements ContainerInterface
138135
{
139136
/** @var array<string, callable> */
140-
private array $services; // phpcs:ignore
137+
private array $services;
141138

142139
/** @param array<string, callable> $services */
143140
public function __construct(array $services)

tests/unit/Container/ContainerConfiguratorTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,9 @@ static function () use (&$called): \B {
416416
/**
417417
* @test
418418
* @runInSeparateProcess
419-
*
420-
* phpcs:disable Inpsyde.CodeQuality.NestingLevel
421419
*/
422420
public function testExtensionByTypeNested(): void
423421
{
424-
// phpcs:enable Inpsyde.CodeQuality.NestingLevel
425422
$logs = [];
426423
$log = static function (object $object, int ...$nums) use (&$logs): object {
427424
foreach ($nums as $num) {

tests/unit/Container/ReadOnlyContainerTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Inpsyde\Modularity\Container\ServiceExtensions;
99
use Inpsyde\Modularity\Tests\TestCase;
1010
use Psr\Container\ContainerInterface;
11+
use Psr\Container\NotFoundExceptionInterface;
1112

1213
class ReadOnlyContainerTest extends TestCase
1314
{
@@ -27,7 +28,7 @@ public function testBasic(): void
2728
*/
2829
public function testGetUnknown(): void
2930
{
30-
static::expectException(\Exception::class);
31+
static::expectException(NotFoundExceptionInterface::class);
3132

3233
$testee = $this->factoryContainer();
3334
$testee->get('unknown');
@@ -125,12 +126,9 @@ public function has(string $id): bool
125126

126127
/**
127128
* @test
128-
*
129-
* phpcs:disable Inpsyde.CodeQuality.NestingLevel
130129
*/
131130
public function testFactoriesAndServices(): void
132131
{
133-
// phpcs:enable Inpsyde.CodeQuality.NestingLevel
134132
$expectedServiceKey = 'service';
135133
$expectedFactoryKey = 'factory';
136134

tests/unit/PackageTest.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
namespace Inpsyde\Modularity\Tests\Unit;
66

77
use Brain\Monkey;
8+
use Inpsyde\Modularity\Module\ExecutableModule;
89
use Inpsyde\Modularity\Module\ExtendingModule;
910
use Inpsyde\Modularity\Module\FactoryModule;
1011
use Inpsyde\Modularity\Module\ServiceModule;
1112
use Inpsyde\Modularity\Package;
12-
use Inpsyde\Modularity\Module\ExecutableModule;
1313
use Inpsyde\Modularity\Properties\Properties;
1414
use Inpsyde\Modularity\Tests\TestCase;
1515
use Psr\Container\ContainerInterface;
@@ -453,12 +453,9 @@ public function testAddModuleFailsAfterBuild(): void
453453

454454
/**
455455
* @test
456-
*
457-
* phpcs:disable Inpsyde.CodeQuality.NestingLevel
458456
*/
459457
public function testBuildResolveServices(): void
460458
{
461-
// phpcs:enable phpcs:disable Inpsyde.CodeQuality.NestingLevel
462459
$module = new class () implements ServiceModule, ExtendingModule, ExecutableModule
463460
{
464461
public function id(): string
@@ -488,7 +485,7 @@ public function extensions(): array
488485
'service' => function (\ArrayObject $current): object {
489486
return new class ($current)
490487
{
491-
public \ArrayObject $object; // phpcs:ignore
488+
private \ArrayObject $object;
492489

493490
public function __construct(\ArrayObject $object)
494491
{

tests/unit/Properties/BasePropertiesTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static function provideBaseNameData(): \Generator
8080
private function factoryBaseProperties(
8181
string $baseName,
8282
string $basePath,
83-
string $baseUrl = null,
83+
?string $baseUrl = null,
8484
array $properties = []
8585
): BaseProperties {
8686

@@ -89,7 +89,7 @@ private function factoryBaseProperties(
8989
public function __construct(
9090
string $baseName,
9191
string $basePath,
92-
string $baseUrl = null,
92+
?string $baseUrl = null,
9393
array $properties = []
9494
) {
9595

tests/unit/Properties/LibraryPropertiesTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace Inpsyde\Modularity\Tests\Unit\Properties;
66

7-
use Inpsyde\Modularity\Properties\Properties;
87
use Inpsyde\Modularity\Properties\LibraryProperties;
8+
use Inpsyde\Modularity\Properties\Properties;
99
use Inpsyde\Modularity\Tests\TestCase;
1010
use org\bovigo\vfs\vfsStream;
1111

@@ -16,7 +16,7 @@ class LibraryPropertiesTest extends TestCase
1616
*/
1717
public function testForLibraryInvalidFile(): void
1818
{
19-
$this->expectException(\Exception::class);
19+
$this->expectException(\Throwable::class);
2020

2121
LibraryProperties::new('non-existing.file')->basePath();
2222
}

tests/unit/Properties/PluginPropertiesTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace Inpsyde\Modularity\Tests\Unit\Properties;
66

7-
use Inpsyde\Modularity\Properties\Properties;
7+
use Brain\Monkey\Functions;
88
use Inpsyde\Modularity\Properties\PluginProperties;
9+
use Inpsyde\Modularity\Properties\Properties;
910
use Inpsyde\Modularity\Tests\TestCase;
10-
use Brain\Monkey\Functions;
1111

1212
class PluginPropertiesTest extends TestCase
1313
{

tests/unit/Properties/ThemePropertiesTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace Inpsyde\Modularity\Tests\Unit\Properties;
66

7+
use Brain\Monkey\Functions;
78
use Inpsyde\Modularity\Properties\Properties;
89
use Inpsyde\Modularity\Properties\ThemeProperties;
910
use Inpsyde\Modularity\Tests\TestCase;
10-
use Brain\Monkey\Functions;
1111

1212
class ThemePropertiesTest extends TestCase
1313
{

0 commit comments

Comments
 (0)