Completed
Push — master ( e4ab2b...e8d46a )
by Franco
24s queued 18s
created

DMSDocumentTaxonomyExtensionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 2
A testGetAllTagsMap() 0 10 1
1
<?php
2
3
class DMSDocumentTaxonomyExtensionTest extends SapphireTest
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
    protected static $fixture_file = 'DMSDocumentTaxonomyExtensionTest.yml';
6
7
    public function setUp()
8
    {
9
        parent::setUp();
10
11
        if (!class_exists('TaxonomyType')) {
12
            $this->markTestSkipped('This test requires silverstripe/taxonomy ^1.2 to be installed. Skipping.');
0 ignored issues
show
Bug introduced by
The method markTestSkipped() does not seem to exist on object<DMSDocumentTaxonomyExtensionTest>.

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...
13
        }
14
    }
15
16
    /**
17
     * Ensure that appropriate tags by taxonomy type are returned, and that their hierarchy is displayd in the title
18
     */
19
    public function testGetAllTagsMap()
20
    {
21
        $extension = new DMSDocumentTaxonomyExtension;
22
        $result = $extension->getAllTagsMap();
23
24
        $this->assertContains('Subject > Mathematics', $result);
25
        $this->assertContains('Subject', $result);
26
        $this->assertContains('Subject > Science > Chemistry', $result);
27
        $this->assertNotContains('Physical Education', $result);
28
    }
29
}
30