Completed
Push — master ( 2b2e5b...2bece2 )
by Damian
09:13 queued 04:51
created

BlogTagsCloudWidgetTest::testGetCMSFields()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 15
rs 9.4285
cc 3
eloc 10
nc 4
nop 0
1
<?php
2
3
class BlogTagsCloudWidgetTest 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
    /**
6
     * @var string
7
     */
8
    public static $fixture_file = 'blog.yml';
9
10
    public function testGetCMSFields() {
11
        if (!class_exists('Widget')) {
12
            $this->markTestSkipped('Widgets module not installed');
0 ignored issues
show
Bug introduced by
The method markTestSkipped() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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
        $widget = new BlogTagsCloudWidget();
16
        $fields = $widget->getCMSFields();
17
        $names = array();
18
        foreach ($fields as $field) {
19
            array_push($names, $field->getName());
20
        }
21
22
        $expected = array('Title', 'Enabled', 'BlogID');
23
        $this->assertEquals($expected, $names);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
24
    }
25
26
    public function testGetTags() {
27
        if (!class_exists('Widget')) {
28
            $this->markTestSkipped('Widgets module not installed');
0 ignored issues
show
Bug introduced by
The method markTestSkipped() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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
        $widget = new BlogTagsCloudWidget();
31
        $blog = $this->objFromFixture('Blog', 'FourthBlog');
32
        $widget->BlogID = $blog->ID;
33
        $widget->write();
34
        $tags = $widget->getTags()->toArray();
35
36
        $tag = $tags[0];
37
        $this->assertEquals('Cat', $tag->TagName);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
38
        $this->assertEquals('/fourth-blog/tag/cat', $tag->Link);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
39
        $this->assertEquals(2, $tag->TagCount);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
40
        $this->assertEquals(5, $tag->NormalizedTag);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
41
42
        $tag = $tags[1];
43
        $this->assertEquals('Cool', $tag->TagName);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
44
        $this->assertEquals('/fourth-blog/tag/cool', $tag->Link);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
45
        $this->assertEquals(3, $tag->TagCount);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
46
        $this->assertEquals(8, $tag->NormalizedTag);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
47
48
        $tag = $tags[2];
49
        $this->assertEquals('Kiwi', $tag->TagName);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
50
        $this->assertEquals('/fourth-blog/tag/kiwi', $tag->Link);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
51
        $this->assertEquals(1, $tag->TagCount);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
52
        $this->assertEquals(3, $tag->NormalizedTag);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
53
54
        $tag = $tags[3];
55
        $this->assertEquals('Popular', $tag->TagName);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
56
        $this->assertEquals('/fourth-blog/tag/popular', $tag->Link);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
57
        $this->assertEquals(4, $tag->TagCount);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
58
        $this->assertEquals(10, $tag->NormalizedTag);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<BlogTagsCloudWidgetTest>.

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...
59
    }
60
}
61