@@ -17,30 +17,47 @@ composer require --dev dms/phpunit-arraysubset-asserts
17
17
18
18
You have two options to use this in your classes: either directly as a static call or as a trait if you wish to keep existing references working.
19
19
20
+ ### Trait use example
21
+
20
22
``` php
21
23
<?php
22
- declare(strict_types=1);
23
24
24
- namespace DMS \Tests;
25
+ namespace Your\Package \Tests;
25
26
26
- use DMS\PHPUnitExtensions\ArraySubset\Assert;
27
27
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
28
28
use PHPUnit\Framework\TestCase;
29
29
30
-
31
- final class AssertTest extends TestCase
30
+ final class ExampleTest extends TestCase
32
31
{
33
32
use ArraySubsetAsserts;
34
-
33
+
35
34
public function testWithTrait(): void
36
35
{
37
36
$expectedSubset = ['bar' => 0];
38
37
39
38
$content = ['bar' => '0'];
40
39
41
40
self::assertArraySubset($expectedSubset, $content, true);
41
+
42
+ $content = ['foo' => '1'];
43
+
44
+ $this->assertArraySubset($expectedSubset, $content, true);
42
45
}
46
+ }
47
+ ```
48
+
49
+ ### Static class method example
43
50
51
+ ``` php
52
+ <?php
53
+
54
+ namespace Your\Package\Tests;
55
+
56
+ use DMS\PHPUnitExtensions\ArraySubset\Assert;
57
+ use PHPUnit\Framework\TestCase;
58
+
59
+ final class ExampleTest extends TestCase
60
+ {
44
61
public function testWithDirectCall(): void
45
62
{
46
63
$expectedSubset = ['bar' => 0];
@@ -50,5 +67,4 @@ final class AssertTest extends TestCase
50
67
Assert::assertArraySubset($expectedSubset, $content, true);
51
68
}
52
69
}
53
-
54
70
```
0 commit comments