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

PointsOfInterestLayerExtensionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 68.75%
Metric Value
wmc 3
lcom 1
cbo 2
dl 24
loc 24
ccs 11
cts 16
cp 0.6875
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUpOnce() 7 7 1
A testUpdateCMSFields() 13 13 2

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 View Code Duplication
    class PointsOfInterestLayerExtensionTest extends SapphireTest
0 ignored issues
show
Duplication introduced by
This class 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...
Coding Style introduced by
Line indented incorrectly; expected 0 spaces, found 4
Loading history...
4
    {
5
        public function setUpOnce()
6
        {
7
            $this->requiredExtensions = array(
8
            'POILayerExtensionPageTO' => array('MapExtension', 'PointsOfInterestLayerExtension'),
9
        );
0 ignored issues
show
Coding Style introduced by
It seems like the identation of this line is off (expected at least 12 spaces, but found 8).
Loading history...
10
            parent::setUpOnce();
11
        }
12
13 1
        public function testUpdateCMSFields()
14
        {
15 1
            $page = new POILayerExtensionPageTO();
16 1
            $fields = $page->getCMSFields();
17 1
            $tab = $fields->findOrMakeTab('Root.MapLayers');
18 1
            $fields = $tab->FieldList();
19 1
            $names = array();
20 1
            foreach ($fields as $field) {
21 1
                $names[] = $field->getName();
22 1
            }
23
24 1
            $this->assertEquals(array('POI Layers'), $names);
25 1
        }
26
    }
27
28
class POILayerExtensionPageTO extends Page implements TestOnly
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 4 spaces, found 0
Loading history...
29
{
0 ignored issues
show
Coding Style introduced by
It seems like the identation of this line is off (expected at least 4 spaces, but found 0).
Loading history...
30
}
31