ShortCodeRelationFinderTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 5
dl 0
loc 34
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFindInRate() 0 29 1
1
<?php
2
class ShortCodeRelationFinderTest extends SapphireTest
3
{
4
    protected static $fixture_file = 'dmstest.yml';
5
6
    public function testFindInRate()
7
    {
8
        Config::inst()->update('DMS', 'shortcode_handler_key', 'dms_document_link');
9
10
        $d1 = $this->objFromFixture('DMSDocument', 'd1');
11
        $d2 = $this->objFromFixture('DMSDocument', 'd2');
12
13
        $page1 = new SiteTree();
14
        $page1->Content = 'Condition:  <a title="document test 1" href="[dms_document_link,id=' . $d1->ID . ']">';
15
        $page1ID = $page1->write();
16
17
        $page2 = new SiteTree();
18
        $page2->Content = 'Condition:  <a title="document test 2" href="[dms_document_link,id=' . $d2->ID . ']">';
19
        $page2ID = $page2->write();
20
21
        $page3 = new SiteTree();
22
        $page3->Content = 'Condition:  <a title="document test 1" href="[dms_document_link,id=' . $d1->ID . ']">';
23
        $page3ID = $page3->write();
24
25
        $finder = new ShortCodeRelationFinder();
26
27
        $ids = $finder->findPageIDs('UnknownShortcode');
28
        $this->assertEquals(0, count($ids));
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<ShortCodeRelationFinderTest>.

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...
29
30
        $ids = $finder->findPageIDs($d1->ID);
31
        $this->assertNotContains($page2ID, $ids);
32
        $this->assertContains($page1ID, $ids);
33
        $this->assertContains($page3ID, $ids);
34
    }
35
}
36