Completed
Push — AUTOMATED_TESTING ( 4870f5...28a62a )
by Gordon
14:27
created

NearestPOIPage_ControllerTest::testFind()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 42
Code Lines 33

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 42
rs 8.8571
cc 1
eloc 33
nc 1
nop 0
1
<?php
2
3
class NearestPOIPage_ControllerTest extends FunctionalTest {
4
5
	protected static $fixture_file = 'mappable-poi/tests/pointsofinterest.yml';
6
	
7
	public function testFind() {
8
		// page needs to be live
9
		$nearPage = $this->objFromFixture('NearestPOIPage', 'StationFinder');
10
		$nearPage->doPublish();
11
12
		$pages = NearestPOIPage::get();
13
		error_log($pages->first()->PointsOfInterestLayerID);
14
15
		// location is MBK
16
		$url = '/station-finder/find?lat=13.7444513&lng=100.5290196';
17
		$response = $this->get($url);
18
		$this->assertEquals(200, $response->getStatusCode());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<NearestPOIPage_ControllerTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
19
		$expected = array(
20
			'Ratchathewi',
21
			'Phaya Thai',
22
			'Chit Lom',
23
			'Victory Monument',
24
			'Nana',
25
			'Sanam Pao',
26
			'Ari',
27
			'Saphan Khwai',
28
			'Mo Chit'
29
		);
30
		$this->assertExactMatchBySelector('table#nearestPOIs td.name', $expected);
31
32
		// location is victory monument
33
		$url = '/station-finder/find?lat=13.7650776&lng=100.5369724';
34
		$response = $this->get($url);
35
		$this->assertEquals(200, $response->getStatusCode());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<NearestPOIPage_ControllerTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
		$expected = array(
37
			'Victory Monument',
38
			'Phaya Thai',
39
			'Sanam Pao',
40
			'Ratchathewi',
41
			'Ari',
42
			'Chit Lom',
43
			'Nana',
44
			'Saphan Khwai',
45
			'Mo Chit'
46
		);
47
		$this->assertExactMatchBySelector('table#nearestPOIs td.name', $expected);
48
	}
49
50
}
51