GoogleStreetViewShortCodeTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 62
Duplicated Lines 77.42 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 3
dl 48
loc 62
ccs 32
cts 32
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testRoadMap() 15 16 1
A testNoLongitude() 6 7 1
A testNoLatitude() 6 7 1
A testNoHeading() 6 7 1
A testZoom() 15 16 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
class GoogleStreetViewShortCodeTest extends SapphireTest
4
{
5
    protected static $fixture_file = 'mappable/tests/shortcodes.yml';
6
7 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...
8
    {
9 1
        GoogleStreetViewShortCodeHandler::resetCounter();
10 1
        $page = $this->objFromFixture('Page', 'StreetView');
11 1
        $html = ShortcodeParser::get_active()->parse($page->Content);
12
        $expected = <<<TEXT
13
Some text
14
15
<div class="streetviewcontainer">
16
<div id="google_streetview_1" class="streetview googlestreetview" data-streetview="" data-latitude="13.811841" data-longitude="100.527309" data-zoom="1" data-pitch="-10" data-heading="162.43"></div>
17
<p class="caption">Canal south from Pracha Rat 1 Soi 28</p>
18
</div>
19
20 1
TEXT;
21 1
        $this->assertEquals($expected, $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GoogleStreetViewShortCodeTest>.

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 1
    }
23
24 1 View Code Duplication
    public function testNoLongitude()
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...
25
    {
26 1
        GoogleStreetViewShortCodeHandler::resetCounter();
27 1
        $page = $this->objFromFixture('Page', 'StreetViewNoLongitude');
28 1
        $html = ShortcodeParser::get_active()->parse($page->Content);
29 1
        $this->assertEquals('Some text', $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GoogleStreetViewShortCodeTest>.

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...
30 1
    }
31
32 1 View Code Duplication
    public function testNoLatitude()
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...
33
    {
34 1
        GoogleStreetViewShortCodeHandler::resetCounter();
35 1
        $page = $this->objFromFixture('Page', 'StreetViewNoLatitude');
36 1
        $html = ShortcodeParser::get_active()->parse($page->Content);
37 1
        $this->assertEquals('Some text', $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GoogleStreetViewShortCodeTest>.

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...
38 1
    }
39
40 1 View Code Duplication
    public function testNoHeading()
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...
41
    {
42 1
        GoogleStreetViewShortCodeHandler::resetCounter();
43 1
        $page = $this->objFromFixture('Page', 'StreetViewNoHeading');
44 1
        $html = ShortcodeParser::get_active()->parse($page->Content);
45 1
        $this->assertEquals('Some text', $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GoogleStreetViewShortCodeTest>.

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...
46 1
    }
47
48 1 View Code Duplication
    public function testZoom()
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...
49
    {
50 1
        GoogleStreetViewShortCodeHandler::resetCounter();
51 1
        $page = $this->objFromFixture('Page', 'StreetViewWithZoom');
52 1
        $html = ShortcodeParser::get_active()->parse($page->Content);
53
        $expected = <<< TEXT
54
Some text
55
56
<div class="streetviewcontainer">
57
<div id="google_streetview_1" class="streetview googlestreetview" data-streetview="" data-latitude="13.811841" data-longitude="100.527309" data-zoom="12" data-pitch="-10" data-heading="162.43"></div>
58
<p class="caption">Canal south from Pracha Rat 1 Soi 28</p>
59
</div>
60
61 1
TEXT;
62 1
        $this->assertEquals($expected, $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GoogleStreetViewShortCodeTest>.

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...
63 1
    }
64
}
65