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

OSMPointOfInterestExtensionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUpOnce() 7 7 1
A testUpdateCMSFields() 12 12 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 OSMPointOfInterestExtensionTest 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...
4
{
5
    public function setUpOnce()
6
    {
7
        $this->requiredExtensions = array(
8
            'OSMTestPageTO' => array('MapExtension', 'OSMPointOfInterestExtension'),
9
        );
10
        parent::setUpOnce();
11
    }
12
13 1
    public function testUpdateCMSFields()
14
    {
15 1
        $page = new OSMTestPageTO();
16 1
        $fields = $page->getCMSFields();
17 1
        $tab = $fields->findOrMakeTab('Root.Main');
18 1
        $fields = $tab->FieldList();
19 1
        $names = array();
20 1
        foreach ($fields as $field) {
21 1
            $names[] = $field->getName();
22 1
        }
23 1
        $this->assertNotContains('OpenStreetMapID', $names);
24 1
    }
25
}
26
27
class OSMTestPageTO extends Page implements TestOnly
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
28
{
29
}
30