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

VariableTest::testGetNullValueException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
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
}