Passed
Branch master (41ef34)
by Roberto
04:08
created

LatLngBountTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 21
dl 0
loc 44
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testLatLngBoundSetterGetter() 0 27 1
A setUp() 0 5 1
1
<?php
2
/**
3
 * Copyright (c) 2018 - present
4
 * Google Maps PHP - LatLngBountTest.php
5
 * author: Roberto Belotti - [email protected]
6
 * web : robertobelotti.com, github.com/biscolab
7
 * Initial version created on: 5/9/2018
8
 * MIT license: https://github.com/biscolab/google-maps-php/blob/master/LICENSE
9
 */
10
11
namespace Biscolab\geocode\Tests;
12
13
use Biscolab\GoogleMaps\Fields\LatLngBoundsFields;
14
use Biscolab\GoogleMaps\Fields\LatLngFields;
15
use Biscolab\GoogleMaps\Object\LatLng;
16
use Biscolab\GoogleMaps\Object\LatLngBounds;
17
use PHPUnit\Framework\TestCase;
18
19
/**
20
 * Class LatLngBountTest
21
 * @package Biscolab\geocode\Tests
22
 */
23
class LatLngBountTest extends TestCase {
24
25
	/**
26
	 * @var LatLngBounds
27
	 */
28
	private $lat_lng_bounds;
29
30
	public function setUp()/* The :void return type declaration that should be here would cause a BC issue */ {
31
32
		parent::setUp(); // TODO: Change the autogenerated stub
33
34
		$this->lat_lng_bounds = new LatLngBounds();
35
	}
36
37
	/**
38
	 * @test
39
	 */
40
	public function testLatLngBoundSetterGetter() {
41
42
		$lat_lng_bounds = $this->lat_lng_bounds;
43
44
		$southwest = new LatLng([
45
			LatLngFields::LAT => 20.89,
46
			LatLngFields::LNG => -40.82,
47
		]);
48
49
		$northeast = new LatLng([
50
			LatLngFields::LAT => 22.73,
51
			LatLngFields::LNG => 3.6370,
52
		]);
53
54
		$lat_lng_bounds->setSouthwest($southwest);
0 ignored issues
show
Bug introduced by
The method setSouthwest() does not exist on Biscolab\GoogleMaps\Object\LatLngBounds. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

54
		$lat_lng_bounds->/** @scrutinizer ignore-call */ 
55
                   setSouthwest($southwest);
Loading history...
55
		$lat_lng_bounds->setNortheast($northeast);
0 ignored issues
show
Bug introduced by
The method setNortheast() does not exist on Biscolab\GoogleMaps\Object\LatLngBounds. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

55
		$lat_lng_bounds->/** @scrutinizer ignore-call */ 
56
                   setNortheast($northeast);
Loading history...
56
57
		$this->assertEquals(new LatLngBounds([
58
			LatLngBoundsFields::SOUTHWEST => [
59
				LatLngFields::LAT => 20.89,
60
				LatLngFields::LNG => -40.82,
61
			],
62
			LatLngBoundsFields::NORTHEAST => [
63
				LatLngFields::LAT => 22.73,
64
				LatLngFields::LNG => 3.6370,
65
			],
66
		]), $lat_lng_bounds);
67
68
69
	}
70
}
71