| Total Complexity | 4 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | final class ChangesTest extends TestCase |
||
| 15 | { |
||
| 16 | public function testFromArray() : void |
||
| 17 | { |
||
| 18 | $change = Change::added('added', true); |
||
| 19 | |||
| 20 | self::assertSame( |
||
| 21 | [$change], |
||
| 22 | iterator_to_array(Changes::fromArray([$change])) |
||
| 23 | ); |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @return mixed[] |
||
| 28 | * @throws \Exception |
||
| 29 | */ |
||
| 30 | public function invalidChangeProvider() : array |
||
| 31 | { |
||
| 32 | return [ |
||
| 33 | [random_int(1, 100)], |
||
| 34 | [random_int(1, 100) / 1000], |
||
| 35 | [uniqid('string', true)], |
||
| 36 | [random_bytes(24)], |
||
| 37 | [[]], |
||
| 38 | [null], |
||
| 39 | [true], |
||
| 40 | [false], |
||
| 41 | [new \stdClass()], |
||
| 42 | ]; |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param mixed $invalidChange |
||
| 47 | * @dataProvider invalidChangeProvider |
||
| 48 | */ |
||
| 49 | public function testFromArrayThowsExceptionWhenInvalidChangePassed($invalidChange) : void |
||
| 50 | { |
||
| 51 | $this->expectException(InvalidArgumentException::class); |
||
| 52 | Changes::fromArray([$invalidChange]); |
||
| 53 | } |
||
| 54 | |||
| 55 | public function testWithAddedChange() : void |
||
| 62 | ); |
||
| 63 | } |
||
| 64 | } |
||
| 65 |