Test Failed
Push — master ( 475bfc...ca0e1d )
by Oss
05:46
created

ExpressionTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A tearDown() 0 4 1
A testGetKeyName() 0 4 1
A testSetGetValue() 0 6 1
1
<?php
2
3
namespace Test\Brownie\BpmOnline\DataService\Column;
4
5
use Brownie\BpmOnline\DataService\Column\Expression;
6
use PHPUnit\Framework\TestCase;
7
8
class ExpressionTest extends TestCase
9
{
10
11
    /**
12
     * @var Expression
13
     */
14
    private $expression;
15
16
    protected function setUp()
17
    {
18
        $this->expression = new Expression([
19
            'value' => 'testValue'
20
        ]);
21
    }
22
23
    protected function tearDown()
24
    {
25
        $this->expression = null;
26
    }
27
28
    public function testGetKeyName()
29
    {
30
        $this->assertNull($this->expression->getKeyName());
31
    }
32
33
    public function testSetGetValue()
34
    {
35
        $this->assertEquals('testValue', $this->expression->getValue());
36
        $this->expression->setValue('valueTest');
0 ignored issues
show
Documentation Bug introduced by
The method setValue does not exist on object<Brownie\BpmOnline...vice\Column\Expression>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
37
        $this->assertEquals('valueTest', $this->expression->getValue());
38
    }
39
}
40