Completed
Pull Request — master (#52)
by CHARRA
03:14
created

VariableTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 37
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetValue() 0 6 1
A testGetNullValueException() 0 5 1
A variableProvider() 0 9 1
1
<?php
2
3
namespace Youshido\Tests\Parser;
4
5
use Youshido\GraphQL\Parser\Ast\ArgumentValue\Variable;
6
7
class VariableTest extends \PHPUnit_Framework_TestCase
8
{
9
    /**
10
     * Test if variable value equals expected value
11
     *
12
     * @dataProvider variableProvider
13
     */
14
    public function testGetValue($actual, $expected)
15
    {
16
        $var = new Variable('foo', 'bar');
17
        $var->setValue($actual);
18
        $this->assertEquals($var->getValue(), $expected);
19
    }
20
21
    /**
22
     * @expectedException \LogicException
23
     * @expectedExceptionMessage Value is not set for variable "foo"
24
     */
25
    public function testGetNullValueException()
26
    {
27
        $var = new Variable('foo', 'bar');
28
        $var->getValue();
29
    }
30
31
    /**
32
     * @return array Array of <mixed: value to set, mixed: expected value>
33
     */
34
    public static function variableProvider()
35
    {
36
        return [
37
            [
38
                0,
39
                0
40
            ]
41
        ];
42
    }
43
}