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

UserFormsCheckboxSetFieldTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 27
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B testValidate() 0 24 1
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
}