testUpdateCMSFields()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 9

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 11
CRAP Score 2
Metric Value
dl 12
loc 12
ccs 11
cts 11
cp 1
rs 9.4286
cc 2
eloc 9
nc 2
nop 0
crap 2
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