Completed
Push — AUTOMATED_TESTING ( bcf349...5906ca )
by Gordon
13:14
created

NearestPOIPage_ControllerTest::testFind()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 46
Code Lines 37

Duplication

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