Passed
Push — 1.0.0 ( 447710...d7e11c )
by Alex
02:06
created

testGivenAValidLatitudeAValidVOIsReturned()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 11
rs 10
1
<?php
2
3
namespace StraTDeS\VO\Tests\Single;
4
5
use StraTDeS\VO\Single\CoordinatesLatitude;
6
use PHPUnit\Framework\TestCase;
7
8
class LatitudeTest extends TestCase
9
{
10
    public function testGivenAValidLatitudeAValidVOIsReturned(): void
11
    {
12
        // Arrange
13
        $latitude = 41.222621365339684;
14
15
        // Act
16
        $latitudeVO = CoordinatesLatitude::fromValue($latitude);
17
18
        // Assert
19
        $this->assertInstanceOf(CoordinatesLatitude::class, $latitudeVO);
20
        $this->assertEquals($latitude, $latitudeVO->value());
21
    }
22
23
    public function testGivenATooLowLatitudeAnExceptionIsThrown(): void
24
    {
25
        $this->expectException(\InvalidArgumentException::class);
26
        $this->expectExceptionMessage("Latitude must be a float number between -90.00 and 90.00.");
27
28
        // Arrange
29
        $latitude = -95.00;
30
31
        // Act
32
        CoordinatesLatitude::fromValue($latitude);
33
    }
34
35
    public function testGivenATooHighLatitudeAnExceptionIsThrown(): void
36
    {
37
        $this->expectException(\InvalidArgumentException::class);
38
        $this->expectExceptionMessage("Latitude must be a float number between -90.00 and 90.00.");
39
40
        // Arrange
41
        $latitude = +95.00;
42
43
        // Act
44
        CoordinatesLatitude::fromValue($latitude);
45
    }
46
}
47