| Total Complexity | 5 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class ActionFieldTest extends TestCase |
||
| 11 | { |
||
| 12 | public function testAction(): void |
||
| 13 | { |
||
| 14 | $actionFirst = 'failed'; |
||
| 15 | $actionSecond = 'delivered'; |
||
| 16 | |||
| 17 | $actionField = new ActionField('name', $actionFirst); |
||
| 18 | $this->assertSame($actionFirst, $actionField->getAction()); |
||
| 19 | |||
| 20 | $actionField->setAction($actionSecond); |
||
| 21 | $this->assertEquals($actionSecond, $actionField->getAction()); |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @dataProvider validActionProvider |
||
| 26 | */ |
||
| 27 | public function testValidAction(string $action): void |
||
| 28 | { |
||
| 29 | $actionField = new ActionField('name', $action); |
||
| 30 | $this->assertEquals($action, $actionField->getAction()); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @dataProvider invalidActionProvider |
||
| 35 | */ |
||
| 36 | public function testInvalidAction(string $action): void |
||
| 37 | { |
||
| 38 | $this->expectException(InvalidArgumentException::class); |
||
| 39 | |||
| 40 | new ActionField('name', $action); |
||
| 41 | } |
||
| 42 | |||
| 43 | public function validActionProvider(): array |
||
| 44 | { |
||
| 45 | return [ |
||
| 46 | ['failed'], |
||
| 47 | ['delayed'], |
||
| 48 | ['delivered'], |
||
| 49 | ['relayed'], |
||
| 50 | ['expanded'], |
||
| 51 | ]; |
||
| 52 | } |
||
| 53 | |||
| 54 | public function invalidActionProvider(): array |
||
| 59 | ]; |
||
| 60 | } |
||
| 61 | } |
||
| 62 |