Completed
Push — master ( 2357ce...f9bf40 )
by Robbie
43:41 queued 08:38
created

EditableCustomRuleTest::testToggleDisplayText()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
/**
4
 * Class EditableCustomRulesTest
5
 */
6
class EditableCustomRuleTest 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/EditableCustomRuleTest.yml';
9
10
    public function testBuildExpression()
11
    {
12
        /** @var EditableCustomRule $rule1 */
13
        $rule1 = $this->objFromFixture('EditableCustomRule', 'rule1');
14
        $result1 = $rule1->buildExpression();
15
16
        //Dropdowns expect change event
17
        $this->assertEquals('change', $result1['event']);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<EditableCustomRuleTest>.

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->assertNotEmpty($result1['operation']);
0 ignored issues
show
Bug introduced by
The method assertNotEmpty() does not seem to exist on object<EditableCustomRuleTest>.

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
        //Check for equals sign
20
        $this->assertContains('==', $result1['operation']);
21
22
        /** @var EditableCustomRule $rule2 */
23
        $rule2 = $this->objFromFixture('EditableCustomRule', 'rule2');
24
        $result2 = $rule2->buildExpression();
25
        //TextField expect change event
26
        $this->assertEquals('keyup', $result2['event']);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<EditableCustomRuleTest>.

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
        $this->assertNotEmpty($result2['operation']);
0 ignored issues
show
Bug introduced by
The method assertNotEmpty() does not seem to exist on object<EditableCustomRuleTest>.

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
        //Check for greater than sign
29
        $this->assertContains('>', $result2['operation']);
30
    }
31
32
    /**
33
     * Test that methods are returned for manipulating the presence of the "hide" CSS class depending
34
     * on whether the field should be hidden or shown
35
     */
36
    public function testToggleDisplayText()
37
    {
38
        $rule1 = $this->objFromFixture('EditableCustomRule', 'rule1');
39
        $this->assertSame('addClass("hide")', $rule1->toggleDisplayText('show'));
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<EditableCustomRuleTest>.

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...
40
        $this->assertSame('removeClass("hide")', $rule1->toggleDisplayText('hide'));
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<EditableCustomRuleTest>.

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...
41
    }
42
}
43