Completed
Pull Request — master (#52)
by Jason
03:49
created

FlexSliderDataExtensionTest::testUpdateCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 1
eloc 10
nc 1
nop 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 3 and the first side effect is on line 33.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
class FlexSliderDataExtensionTest extends FlexSliderTest
4
{
5
    public function testUpdateCMSFields()
6
    {
7
        $extension = new FlexSlider();
8
        $object = Page::create();
9
        $fields = $object->getCMSFields();
10
        $extension->updateCMSFields($fields);
11
        $this->assertNull($fields->dataFieldByName('Slides'));
0 ignored issues
show
Bug introduced by
The method assertNull() does not seem to exist on object<FlexSliderDataExtensionTest>.

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...
12
13
        $object->write();
14
        $fields = $object->getCMSFields();
15
        $extension->updateCMSFields($fields);
16
        $this->assertNotNull($fields->dataFieldbyName('Slides'));
0 ignored issues
show
Bug introduced by
The method assertNotNull() does not seem to exist on object<FlexSliderDataExtensionTest>.

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...
17
    }
18
19
    public function testGetSlideshow()
20
    {
21
        $object = singleton('Page');
22
        $object->write();
23
        $slide1 = $this->objFromFixture('SlideImage', 'slide1');
24
        $image = $this->objFromFixture('Image', 'image1');
25
        $slide1->ImageID = $image->ID;
26
        $object->Slides()->add($slide1);
27
        $slides = $object->Slides();
28
        $this->assertTrue(is_a($slides, 'DataList'));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<FlexSliderDataExtensionTest>.

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
}
31
32
33
Page::add_extension('FlexSlider');