Completed
Push — master ( e4ab2b...e8d46a )
by Franco
13s
created

extensions/DMSDocumentTaxonomyExtensionTest.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
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