Passed
Push — main ( a567d8...0d9107 )
by Alex
02:04 queued 37s
created

LatitudeTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 37
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGivenATooLowLatitudeAnExceptionIsThrown() 0 10 1
A testGivenAValidLatitudeAValidVOIsReturned() 0 11 1
A testGivenATooHighLatitudeAnExceptionIsThrown() 0 10 1
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