Completed
Push — AUTOMATED_TESTING ( 00f553...8b04e2 )
by Gordon
08:28
created

NearestPOIPage_ControllerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

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

1 Method

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