Completed
Pull Request — master (#534)
by Damian
34:19
created

UserFormsCheckboxSetFieldTest::testValidate()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 8.9713
c 0
b 0
f 0
cc 1
eloc 17
nc 1
nop 0
1
<?php
2
3
class UserFormsCheckboxSetFieldTest 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
    public function testValidate() {
6
        $field = new UserFormsCheckboxSetField('Field', 'My field', array('One' => 'One', 'Two' => 'Two'));
7
        $validator = new RequiredFields();
8
9
        // String values
10
        $field->setValue('One');
11
        $this->assertTrue($field->validate($validator));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<UserFormsCheckboxSetFieldTest>.

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
        $field->setValue('One,Two');
13
        $this->assertTrue($field->validate($validator));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<UserFormsCheckboxSetFieldTest>.

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...
14
        $field->setValue('Three,Four');
15
        $this->assertFalse($field->validate($validator));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<UserFormsCheckboxSetFieldTest>.

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...
16
17
        // Array values
18
        $field->setValue(array('One'));
19
        $this->assertTrue($field->validate($validator));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<UserFormsCheckboxSetFieldTest>.

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
        $field->setValue(array('One', 'Two'));
21
        $this->assertTrue($field->validate($validator));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<UserFormsCheckboxSetFieldTest>.

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...
22
23
        // Invalid
24
        $field->setValue('Three');
25
        $this->assertFalse($field->validate($validator));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<UserFormsCheckboxSetFieldTest>.

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
        $field->setValue(array('Three', 'Four'));
27
        $this->assertFalse($field->validate($validator));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<UserFormsCheckboxSetFieldTest>.

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...
28
    }
29
}