Completed
Push — master ( b78927...2357ce )
by Damian
20:56
created

testMatches()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 51
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 51
rs 9.4109
c 0
b 0
f 0
cc 1
eloc 26
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/**
4
 * Class EditableCustomRulesTest
5
 */
6
class UserDefinedForm_EmailRecipientConditionTest 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...
7
{
8
    protected static $fixture_file = 'userforms/tests/UserDefinedForm_EmailRecipientConditionTest.yml';
9
10
    /**
11
     * Various matching tests
12
     */
13
    public function testMatches()
14
    {
15
        $fixtureClass = 'UserDefinedForm_EmailRecipientCondition';
16
        //Test Blank
17
        /** @var UserDefinedForm_EmailRecipientCondition $blankObj */
18
        $blankObj = $this->objFromFixture($fixtureClass, 'blankTest');
19
        $this->assertTrue($blankObj->matches(array('Name' => null)));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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
        $this->assertFalse($blankObj->matches(array('Name' => 'Jane')));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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...
21
22
        //Test IsNotBlank
23
        /** @var UserDefinedForm_EmailRecipientCondition $blankObj */
24
        $blankObj = $this->objFromFixture($fixtureClass, 'isNotBlankTest');
25
        $this->assertTrue($blankObj->matches(array('Name' => 'Jane')));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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
        $this->assertFalse($blankObj->matches(array('Name' => null)));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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...
27
28
        //Test ValueLessthan
29
        /** @var UserDefinedForm_EmailRecipientCondition $blankObj */
30
        $blankObj = $this->objFromFixture($fixtureClass, 'valueLessThanTest');
31
        $this->assertTrue($blankObj->matches(array('Age' => 17)));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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...
32
        $this->assertFalse($blankObj->matches(array('Age' => 19)));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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...
33
34
        //Test ValueLessThanEquals
35
        /** @var UserDefinedForm_EmailRecipientCondition $blankObj */
36
        $blankObj = $this->objFromFixture($fixtureClass, 'valueLessThanEqualTest');
37
        $this->assertTrue($blankObj->matches(array('Age' => 18)));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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
        $this->assertFalse($blankObj->matches(array('Age' => 19)));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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...
39
40
        //Test ValueGreaterThan
41
        /** @var UserDefinedForm_EmailRecipientCondition $blankObj */
42
        $blankObj = $this->objFromFixture($fixtureClass, 'valueGreaterThanTest');
43
        $this->assertTrue($blankObj->matches(array('Age' => 19)));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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...
44
        $this->assertFalse($blankObj->matches(array('Age' => 17)));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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
46
        //Test ValueGreaterThanEquals
47
        /** @var UserDefinedForm_EmailRecipientCondition $blankObj */
48
        $blankObj = $this->objFromFixture($fixtureClass, 'valueGreaterThanEqualTest');
49
        $this->assertTrue($blankObj->matches(array('Age' => 18)));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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...
50
        $this->assertFalse($blankObj->matches(array('Age' => 17)));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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...
51
52
        //Test Equals
53
        /** @var UserDefinedForm_EmailRecipientCondition $blankObj */
54
        $blankObj = $this->objFromFixture($fixtureClass, 'equalsTest');
55
        $this->assertTrue($blankObj->matches(array('Age' => 18)));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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
        $this->assertFalse($blankObj->matches(array('Age' => 17)));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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...
57
58
        //Test NotEquals
59
        /** @var UserDefinedForm_EmailRecipientCondition $blankObj */
60
        $blankObj = $this->objFromFixture($fixtureClass, 'notEqualsTest');
61
        $this->assertTrue($blankObj->matches(array('Age' => 17)));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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...
62
        $this->assertFalse($blankObj->matches(array('Age' => 18)));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<UserDefinedForm_E...RecipientConditionTest>.

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...
63
    }
64
}
65