Total Complexity | 5 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
10 | class InitializationTest extends TestCase |
||
11 | { |
||
12 | |||
13 | public function testShouldInitializeWithObjectAndClassName() |
||
14 | { |
||
15 | //when: |
||
16 | PhpObjectDecorator::decorate(new ChildObjectToDecorate()); |
||
17 | |||
18 | //then: |
||
19 | $this->assertTrue(true); |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * @dataProvider invalidClassNameProvider |
||
24 | */ |
||
25 | public function testShouldNotInitializeWithNonObjectAndClassName(mixed $obj) |
||
26 | { |
||
27 | //expect: |
||
28 | $this->expectException(PhpObjectDecoratorException::class); |
||
29 | |||
30 | //when: |
||
31 | PhpObjectDecorator::decorate($obj); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @dataProvider invalidClassNameProvider |
||
36 | */ |
||
37 | public function testShouldNotInitializeWithInvalidClassName(mixed $className) |
||
44 | } |
||
45 | |||
46 | public function invalidObjectProvider(): array |
||
47 | { |
||
48 | return [["string"], [[]], [10], [true], [null], [new \stdClass()]]; |
||
49 | } |
||
50 | |||
51 | public function invalidClassNameProvider(): array |
||
54 | } |
||
55 | |||
56 | |||
57 | } |