GoogleMapShortCodeTest::testNoLongitude()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * Testing YouTubeShortCodeHandler.
5
 */
6
class GoogleMapShortCodeTest extends SapphireTest
7
{
8
    protected static $fixture_file = 'mappable/tests/shortcodes.yml';
9
10 1 View Code Duplication
    public function testRoadMap()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
    {
12 1
        GoogleMapShortCodeHandler::resetCounter();
13 1
        $page = $this->objFromFixture('Page', 'RoadMap');
14 1
        $html = ShortcodeParser::get_active()->parse($page->Content);
15
        $expected = <<<TEXT
16
Some text
17
18
<div class="googlemapcontainer">
19
<div id="google_sc_map_1" class="map googlemap" data-shortcode-map="" data-latitude="13.7402946" data-longitude="100.5525439" data-zoom="14" data-maptype="road" data-allowfullscreen="1"></div>
20
<p class="caption">Roads in Central Bangkok</p>
21
</div>
22
23 1
TEXT;
24 1
        $this->assertEquals($expected, $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GoogleMapShortCodeTest>.

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 1
    }
26
27 1 View Code Duplication
    public function testAerialMap()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
28
    {
29 1
        GoogleMapShortCodeHandler::resetCounter();
30 1
        $page = $this->objFromFixture('Page', 'AerialMap');
31 1
        $html = ShortcodeParser::get_active()->parse($page->Content);
32
        $expected = <<<TEXT
33
Some text
34
35
<div class="googlemapcontainer">
36
<div id="google_sc_map_1" class="map googlemap" data-shortcode-map="" data-latitude="13.815483" data-longitude="100.5447213" data-zoom="20" data-maptype="aerial" data-allowfullscreen="1"></div>
37
<p class="caption">Bang Sue Train Depot, Thailand</p>
38
</div>
39
40 1
TEXT;
41 1
        $this->assertEquals($expected, $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GoogleMapShortCodeTest>.

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 1
    }
43
44 1 View Code Duplication
    public function testHybridMap()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
45
    {
46 1
        GoogleMapShortCodeHandler::resetCounter();
47 1
        $page = $this->objFromFixture('Page', 'HybridMap');
48 1
        $html = ShortcodeParser::get_active()->parse($page->Content);
49
        $expected = <<<TEXT
50
Some text
51
52
<div class="googlemapcontainer">
53
<div id="google_sc_map_1" class="map googlemap" data-shortcode-map="" data-latitude="13.8309545" data-longitude="100.5577219" data-zoom="18" data-maptype="hybrid" data-allowfullscreen="1"></div>
54
<p class="caption">Junction in Bangkok, Thailand</p>
55
</div>
56
57 1
TEXT;
58 1
        $this->assertEquals($expected, $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GoogleMapShortCodeTest>.

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...
59 1
    }
60
61 1 View Code Duplication
    public function testTerrainmap()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
62
    {
63 1
        GoogleMapShortCodeHandler::resetCounter();
64 1
        $page = $this->objFromFixture('Page', 'TerrainMap');
65 1
        $html = ShortcodeParser::get_active()->parse($page->Content);
66
        $expected = <<<TEXT
67
Some text
68
69
<div class="googlemapcontainer">
70
<div id="google_sc_map_1" class="map googlemap" data-shortcode-map="" data-latitude="18.8032393" data-longitude="98.9166518" data-zoom="14" data-maptype="terrain" data-allowfullscreen="1"></div>
71
<p class="caption">Mountains west of Chiang Mai</p>
72
</div>
73
74 1
TEXT;
75 1
        $this->assertEquals($expected, $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GoogleMapShortCodeTest>.

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...
76 1
    }
77
78 1
    public function testNoLongitude()
79
    {
80 1
        $page = $this->objFromFixture('Page', 'MapWithNoLongitude');
81 1
        $html = ShortcodeParser::get_active()->parse($page->Content);
82 1
        $this->assertEquals('Some text', $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GoogleMapShortCodeTest>.

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...
83 1
    }
84
85 1
    public function testNoLatitude()
86
    {
87 1
        $page = $this->objFromFixture('Page', 'MapWithNoLatitude');
88 1
        $html = ShortcodeParser::get_active()->parse($page->Content);
89 1
        $this->assertEquals('Some text', $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GoogleMapShortCodeTest>.

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...
90 1
    }
91
}
92