| @@ 9-42 (lines=34) @@ | ||
| 6 | ||
| 7 | use PhpValueObjects\Tests\BaseUnitTestCase; |
|
| 8 | ||
| 9 | final class LatitudeTest extends BaseUnitTestCase |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * @test |
|
| 13 | */ |
|
| 14 | public function itShouldReturnLatitude(): void |
|
| 15 | { |
|
| 16 | $latitude = $this->faker()->latitude; |
|
| 17 | ||
| 18 | $latVo = new Latitude($latitude); |
|
| 19 | ||
| 20 | $this->assertSame($latitude, $latVo->value()); |
|
| 21 | } |
|
| 22 | ||
| 23 | public function invalidLatitudeProvider(): array |
|
| 24 | { |
|
| 25 | return [ |
|
| 26 | [$this->faker()->randomFloat(4, -200, -95)], |
|
| 27 | [$this->faker()->randomFloat(4, 100, 200)] |
|
| 28 | ]; |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @test |
|
| 33 | * |
|
| 34 | * @dataProvider invalidLatitudeProvider |
|
| 35 | */ |
|
| 36 | public function itShouldThrowsException(float $data): void |
|
| 37 | { |
|
| 38 | $this->expectException(\Exception::class); |
|
| 39 | ||
| 40 | new Latitude($data); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||
| @@ 9-42 (lines=34) @@ | ||
| 6 | ||
| 7 | use PhpValueObjects\Tests\BaseUnitTestCase; |
|
| 8 | ||
| 9 | final class LongitudeTest extends BaseUnitTestCase |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * @test |
|
| 13 | */ |
|
| 14 | public function itShouldReturnLongitude(): void |
|
| 15 | { |
|
| 16 | $longitude = $this->faker()->longitude; |
|
| 17 | ||
| 18 | $longVO = new Longitude($longitude); |
|
| 19 | ||
| 20 | $this->assertSame($longitude, $longVO->value()); |
|
| 21 | } |
|
| 22 | ||
| 23 | public function invalidLongitudeProvider(): array |
|
| 24 | { |
|
| 25 | return [ |
|
| 26 | [$this->faker()->randomFloat(4, -200, -185)], |
|
| 27 | [$this->faker()->randomFloat(4, 185, 200)] |
|
| 28 | ]; |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @test |
|
| 33 | * |
|
| 34 | * @dataProvider invalidLongitudeProvider |
|
| 35 | */ |
|
| 36 | public function itShouldThrowsException($data): void |
|
| 37 | { |
|
| 38 | $this->expectException(\Exception::class); |
|
| 39 | ||
| 40 | new Longitude($data); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||