Skip to content

Commit 39af8df

Browse files
committed
🚿 move and exclude test containers
1 parent 0cdb959 commit 39af8df

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

phpunit.xml.dist

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
>
88
<testsuites>
99
<testsuite name="php-settings-container test suite">
10-
<directory>./tests/</directory>
11-
<exclude>./tests/ExceptionTestContainer.php</exclude>
12-
<exclude>./tests/PropertyHooksContainer.php</exclude>
13-
<exclude>./tests/TestContainer.php</exclude>
14-
<exclude>./tests/TestOptionsTrait.php</exclude>
10+
<directory>tests</directory>
11+
<exclude>tests/Subjects</exclude>
1512
</testsuite>
1613
</testsuites>
1714
<source>

tests/ContainerTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace chillerlan\SettingsTest;
1313

14+
use chillerlan\SettingsTest\Subjects\{ExceptionTestContainer, TestContainer};
1415
use PHPUnit\Framework\Attributes\Test;
1516
use PHPUnit\Framework\TestCase;
1617
use InvalidArgumentException, JsonException, RuntimeException, TypeError;
@@ -140,14 +141,14 @@ public function serializable():void{
140141
]);
141142

142143
// serialize will return the object in its current state including private properties
143-
$expected = 'O:37:"chillerlan\SettingsTest\TestContainer":7:{s:5:"test3";s:4:"what";s:5:"test1";s:2:"no";'.
144+
$expected = 'O:46:"chillerlan\SettingsTest\Subjects\TestContainer":7:{s:5:"test3";s:4:"what";s:5:"test1";s:2:"no";'.
144145
's:5:"test2";b:1;s:13:"testConstruct";s:7:"success";s:5:"test4";N;s:5:"test5";s:0:"";s:5:"test6";N;}';
145146

146147
$serialized = serialize($container);
147148

148149
$this::assertSame($expected, $serialized);
149150

150-
/** @var \chillerlan\SettingsTest\TestContainer $container */
151+
/** @var \chillerlan\SettingsTest\Subjects\TestContainer $container */
151152
$container = unserialize($serialized); // object should remain in the same state
152153

153154
$this::assertSame($expected, $container->serialize());

tests/PropertyHooksTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace chillerlan\SettingsTest;
1313

14+
use chillerlan\SettingsTest\Subjects\PropertyHooksContainer;
1415
use PHPUnit\Framework\Attributes\{RequiresPhp, Test};
1516
use PHPUnit\Framework\TestCase;
1617
use function serialize, unserialize;
@@ -45,14 +46,15 @@ public function serializable():void{
4546
]);
4647

4748
// the object state should be retained, bypassing existing property hooks and magic get/set
48-
$expected = 'O:46:"chillerlan\SettingsTest\PropertyHooksContainer":4:{s:5:"test1";s:3:"foo";s:5:"test2";s:3:"bar";'.
49-
's:5:"test3";s:32:"3858f62230ac3c915f300c664312c63f";s:5:"test4";s:32:"3858f62230ac3c915f300c664312c63f";}';
49+
$expected = 'O:55:"chillerlan\SettingsTest\Subjects\PropertyHooksContainer":4:{s:5:"test1";'.
50+
's:3:"foo";s:5:"test2";s:3:"bar";s:5:"test3";s:32:"3858f62230ac3c915f300c664312c63f";'.
51+
's:5:"test4";s:32:"3858f62230ac3c915f300c664312c63f";}';
5052

5153
$serialized = serialize($container);
5254

5355
$this::assertSame($expected, $serialized);
5456

55-
/** @var \chillerlan\SettingsTest\PropertyHooksContainer $container */
57+
/** @var \chillerlan\SettingsTest\Subjects\PropertyHooksContainer $container */
5658
$container = unserialize($serialized); // object should remain in the same state
5759

5860
$this::assertSame($expected, $container->serialize());

tests/ExceptionTestContainer.php renamed to tests/Subjects/ExceptionTestContainer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
declare(strict_types=1);
1111

12-
namespace chillerlan\SettingsTest;
12+
namespace chillerlan\SettingsTest\Subjects;
1313

1414
use chillerlan\Settings\Attributes\ThrowOnInvalidProperty;
1515
use chillerlan\Settings\SettingsContainerAbstract;

tests/PropertyHooksContainer.php renamed to tests/Subjects/PropertyHooksContainer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
declare(strict_types=1);
1111

12-
namespace chillerlan\SettingsTest;
12+
namespace chillerlan\SettingsTest\Subjects;
1313

1414
use chillerlan\Settings\SettingsContainerAbstract;
1515
use function md5;

tests/TestContainer.php renamed to tests/Subjects/TestContainer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
declare(strict_types=1);
1111

12-
namespace chillerlan\SettingsTest;
12+
namespace chillerlan\SettingsTest\Subjects;
1313

1414
use chillerlan\Settings\SettingsContainerAbstract;
1515

tests/TestOptionsTrait.php renamed to tests/Subjects/TestOptionsTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
declare(strict_types=1);
1111

12-
namespace chillerlan\SettingsTest;
12+
namespace chillerlan\SettingsTest\Subjects;
1313

1414
use function sha1;
1515

0 commit comments

Comments
 (0)