Completed
Push — master ( 18f749...9fc766 )
by Gordon
17:08 queued 02:10
created

GalleryImageTest::testGetPortletTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 6
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
class GalleryImageTest extends TestWithImage {
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
    protected static $fixture_file = 'ss3gallery/tests/ss3gallery.yml';
5
6
    public function testCMSFields() {
7
        $gi = new GalleryImage();
8
        $fields = $gi->getCMSFields();
9
        $tab = $fields->findOrMakeTab('Root.Main');
10
        $fields = $tab->FieldList();
11
12
        $names = array();
13
        foreach ($fields as $field) {
14
            array_push($names, $field->getName());
15
        }
16
17
        $expected = array('Title', 'Aperture', 'ShutterSpeed', 'TakenAt', 'ISO',
18
            'Orientation', 'Image');
19
        $this->assertEquals($expected, $names);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GalleryImageTest>.

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...
20
21
        $fields = $gi->getCMSFields();
22
        $tab = $fields->findOrMakeTab('Root.Location');
23
        $fields = $tab->FieldList();
24
25
        $names = array();
26
        foreach ($fields as $field) {
27
            array_push($names, $field->getName());
28
        }
29
        $expected = array('LatLonZoomLevel', 'MapPinIcon');
30
        $this->assertEquals($expected, $names);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GalleryImageTest>.

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...
31
    }
32
33
    public function testGetThumbnail() {
34
        $gi = $this->objFromFixture('GalleryImage', 'gi01');
35
        $thumbnail = $gi->getThumbnail();
36
        $this->assertEquals(100, $thumbnail->Width);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GalleryImageTest>.

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...
37
        $this->assertEquals(100, $thumbnail->Height);
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GalleryImageTest>.

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
    }
39
40
     public function testGetPortletTitle() {
41
        $gi = $this->objFromFixture('GalleryImage', 'gi01');
42
        $this->assertEquals($gi->Title, $gi->getPortletTitle());
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GalleryImageTest>.

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...
43
        $gi->Title = 'Another title';
44
        $this->assertEquals($gi->Title, $gi->getPortletTitle());
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GalleryImageTest>.

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
    }
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 8 spaces, found 4
Loading history...
Coding Style introduced by
Closing brace indented incorrectly; expected 5 spaces, found 4
Loading history...
46
47
    public function testGetPortletImage() {
0 ignored issues
show
Coding Style introduced by
It seems like the identation of this line is off (expected at least 8 spaces, but found 4).
Loading history...
48
        $gi = $this->objFromFixture('GalleryImage', 'gi01');
0 ignored issues
show
Coding Style introduced by
It seems like the identation of this line is off (expected at least 12 spaces, but found 8).
Loading history...
49
        $this->assertEquals($gi->getPortletImage()->Filename,
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GalleryImageTest>.

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...
Coding Style introduced by
It seems like the identation of this line is off (expected at least 12 spaces, but found 8).
Loading history...
50
                                        'assets/TestImageSS3Gallery/test.jpg');
51
    }
52
53
    public function testGetPortletCaption() {
54
        $gi = $this->objFromFixture('GalleryImage', 'gi01');
55
        $this->assertEquals('', $gi->getPortletCaption());
1 ignored issue
show
Bug introduced by
The method assertEquals() does not seem to exist on object<GalleryImageTest>.

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
    }
57
}
58