| Total Complexity | 4 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class ArgumentFormatterTest extends TestCase |
||
| 10 | { |
||
| 11 | /** @test */ |
||
| 12 | public function it_respects_is_contract(): void |
||
| 13 | { |
||
| 14 | $this->assertInstanceOf(ArgumentFormatterContract::class, new ArgumentFormatter()); |
||
| 15 | } |
||
| 16 | |||
| 17 | /** @test */ |
||
| 18 | public function it_formats_a_string(): void |
||
| 19 | { |
||
| 20 | $argumentFormatter = new ArgumentFormatter(); |
||
| 21 | |||
| 22 | $args = ['string' => 'foo']; |
||
| 23 | |||
| 24 | $result = $argumentFormatter->format($args); |
||
| 25 | |||
| 26 | $this->assertEquals($result, '"foo"'); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** @test */ |
||
| 30 | public function it_formats_a_array(): void |
||
| 31 | { |
||
| 32 | $argumentFormatter = new ArgumentFormatter(); |
||
| 33 | |||
| 34 | $args = ['array' => ['foo' => 'bar', 'key' => 'value']]; |
||
| 35 | |||
| 36 | $result = $argumentFormatter->format($args); |
||
| 37 | |||
| 38 | $this->assertEquals($result, '["bar", "value"]'); |
||
| 39 | } |
||
| 40 | |||
| 41 | /** @test */ |
||
| 42 | public function it_formats_a_object(): void |
||
| 43 | { |
||
| 44 | $argumentFormatter = new ArgumentFormatter(); |
||
| 45 | |||
| 46 | $object = new \stdClass(); |
||
| 47 | |||
| 48 | $result = $argumentFormatter->format([$object]); |
||
| 49 | |||
| 50 | $this->assertEquals($result, 'Object(stdClass)'); |
||
| 51 | } |
||
| 53 |