Completed
Push — AUTOMATED_TESTING ( 377d38...bcf349 )
by Gordon
24:16 queued 09:19
created

NearestPOIPage_ControllerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1
Metric Value
wmc 1
lcom 1
cbo 1
dl 0
loc 54
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFind() 0 48 1
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
		$link = $nearPage->Link();
12
		error_log("POI PAGE LINK:".$link);
13
14
		$pages = NearestPOIPage::get();
15
		error_log($pages->first()->PointsOfInterestLayerID);
16
17
		$url = $link;
18
		$response = $this->get($url);
19
		$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...
20
21
		// location is MBK
22
		$url = $link . 'find?lat=13.7444513&lng=100.5290196';
23
		$response = $this->get($url);
24
		$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...
25
		$expected = array(
26
			'Ratchathewi',
27
			'Phaya Thai',
28
			'Chit Lom',
29
			'Victory Monument',
30
			'Nana',
31
			'Sanam Pao',
32
			'Ari',
33
			'Saphan Khwai',
34
			'Mo Chit'
35
		);
36
		$this->assertExactMatchBySelector('table#nearestPOIs td.name', $expected);
37
38
		// location is victory monument
39
		$url = $link . 'find?lat=13.7650776&lng=100.5369724';
40
		$response = $this->get($url);
41
		$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...
42
		$expected = array(
43
			'Victory Monument',
44
			'Phaya Thai',
45
			'Sanam Pao',
46
			'Ratchathewi',
47
			'Ari',
48
			'Chit Lom',
49
			'Nana',
50
			'Saphan Khwai',
51
			'Mo Chit'
52
		);
53
		$this->assertExactMatchBySelector('table#nearestPOIs td.name', $expected);
54
	}
55
56
}
57