Completed
Pull Request — master (#10)
by Helpful
14:43
created

EditableFieldGroupTest::testRequiredFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
/**
4
 * EditableFieldGroupTest contains test cases for test EditableFieldGroup class
5
 *
6
 * @author  Mohamed Alsharaf <[email protected]>
7
 * @package editablefield
8
 */
9
class EditableFieldGroupTest extends FunctionalTest
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...
10
{
11
    protected static $fixture_file = 'EditableFieldGroupTest.yml';
12
13
    public function testEmptyGroup()
14
    {
15
        $object = $this->objFromFixture('EditableFieldGroup', 'group-empty');
16
17
        $this->assertEquals('Group Empty', $object->Title);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<EditableFieldGroupTest>.

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...
18
        $this->assertEquals(0, $object->Fields()->Count());
0 ignored issues
show
Bug introduced by
The method Fields() does not exist on DataObject. Did you maybe mean beforeUpdateCMSFields()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
Bug introduced by
The method assertEquals() does not seem to exist on object<EditableFieldGroupTest>.

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...
19
    }
20
21
    public function testGroupFields()
22
    {
23
        $object = $this->objFromFixture('EditableFieldGroup', 'group-1');
24
        $fields = $object->Fields();
0 ignored issues
show
Bug introduced by
The method Fields() does not exist on DataObject. Did you maybe mean beforeUpdateCMSFields()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
25
        $this->assertGreaterThan(0, $fields->Count());
0 ignored issues
show
Bug introduced by
The method assertGreaterThan() does not seem to exist on object<EditableFieldGroupTest>.

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...
26
27
        $cmsFields = $object->getCMSFields();
28
        $gridFields = $cmsFields->dataFieldByName('Fields');
29
30
        $this->assertTrue($gridFields !== null);
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<EditableFieldGroupTest>.

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
        $list = $gridFields->getList();
33
        $this->assertEquals($list->Count(), $fields->Count());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<EditableFieldGroupTest>.

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...
34
    }
35
36
    public function testRequiredFields()
37
    {
38
        $object = $this->objFromFixture('EditableFieldGroup', 'group-empty');
39
        $validator = $object->getCMSValidator();
40
41
        $this->assertInstanceOf('RequiredFields', $validator);
0 ignored issues
show
Bug introduced by
The method assertInstanceOf() does not seem to exist on object<EditableFieldGroupTest>.

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...
42
        $this->assertTrue($validator->fieldIsRequired('Title'));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<EditableFieldGroupTest>.

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
    }
44
}
45