Completed
Push — 3.1 ( 6c19c5...97d1e4 )
by Gordon
04:55
created

NearestPOIPage_ControllerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 56
ccs 42
cts 42
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFind() 0 51 2
1
<?php
2
3
class NearestPOIPage_ControllerTest extends FunctionalTest
0 ignored issues
show
Coding Style introduced by
This class is not in CamelCase format.

Classes in PHP are usually named in CamelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.

Thus the name database provider becomes DatabaseProvider.

Loading history...
4
{
5
    protected static $fixture_file = 'mappable-poi/tests/pointsofinterest.yml';
6
7 1
    public function testFind()
8
    {
9
        // page needs to be live
10 1
        $nearPage = $this->objFromFixture('NearestPOIPage', 'StationFinder');
11 1
        $this->logInWithPermission('ADMIN');
12 1
        $nearPage->doPublish();
13 1
        if (Member::currentUser()) {
14 1
            Member::currentUser()->logOut();
15 1
        }
16 1
        $link = $nearPage->Link();
17 1
        error_log('POI PAGE LINK:'.$link);
18
19 1
        $url = $link;
20 1
        error_log('TRYING URL '.$url);
21 1
        $response = $this->get($url);
22 1
        $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
24
        // location is MBK
25 1
        $url = $link.'find?lat=13.7444513&lng=100.5290196';
26 1
        $response = $this->get($url);
27 1
        $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...
28
        $expected = array(
29 1
            'Ratchathewi',
30 1
            'Phaya Thai',
31 1
            'Chit Lom',
32 1
            'Victory Monument',
33 1
            'Nana',
34 1
            'Sanam Pao',
35 1
            'Ari',
36 1
            'Saphan Khwai',
37 1
            'Mo Chit',
38 1
        );
39 1
        $this->assertExactMatchBySelector('table#nearestPOIs td.name', $expected);
40
41
        // location is victory monument
42 1
        $url = $link.'find?lat=13.7650776&lng=100.5369724';
43 1
        $response = $this->get($url);
44 1
        $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...
45
        $expected = array(
46 1
            'Victory Monument',
47 1
            'Phaya Thai',
48 1
            'Sanam Pao',
49 1
            'Ratchathewi',
50 1
            'Ari',
51 1
            'Chit Lom',
52 1
            'Nana',
53 1
            'Saphan Khwai',
54 1
            'Mo Chit',
55 1
        );
56 1
        $this->assertExactMatchBySelector('table#nearestPOIs td.name', $expected);
57 1
    }
58
}
59