testMutatingDateTimeWithExplicitNullParameter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Youshido\Tests\Issues\Issue90;
4
5
use Youshido\GraphQL\Execution\Processor;
6
use Youshido\Tests\Issues\Issue90\Issue90Schema;
7
8
/**
9
 * User: stefano.corallo
10
 * Date: 25/11/16
11
 * Time: 9.39
12
 */
13
class Issue90Test extends \PHPUnit_Framework_TestCase
14
{
15
16 View Code Duplication
    public function testQueryDateTimeTypeWithDateParameter()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
    {
18
        $schema = new Issue90Schema();
19
        $processor = new Processor($schema);
20
        $processor->processPayload("query{ echo(date: \"2016-11-25 09:53am\") }");
21
        $res = $processor->getResponseData();
22
23
        self::assertCount(1, $res, "Invalid response array received"); //only data expected
24
25
        self::assertNotNull($res['data']['echo'], "Invalid echo response received");
26
27
        self::assertEquals("2016-11-25 09:53am", $res['data']['echo']);
28
    }
29
30 View Code Duplication
    public function testQueryDateTimeTypeWithoutParameter()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
    {
32
        $processor = new Processor(new Issue90Schema());
33
        $processor->processPayload("query{ echo }");
34
        $res = $processor->getResponseData();
35
36
        self::assertCount(1, $res, "Invalid response array received"); //only data expected
37
38
        self::assertNull($res['data']['echo']);
39
    }
40
41 View Code Duplication
    public function testQueryDateTimeTypeWithNullParameter()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
42
    {
43
        $processor = new Processor(new Issue90Schema());
44
        $processor->processPayload("query{ echo(date: null) }");
45
        $res = $processor->getResponseData();
46
47
        self::assertCount(1, $res, "Invalid response array received"); //only data expected
48
49
        self::assertNull($res['data']['echo'], "Error Quering with explicit date null parameter ");
50
    }
51
52 View Code Duplication
    public function testMutatingDateTimeWithParameter()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
53
    {
54
        $schema = new Issue90Schema();
55
        $processor = new Processor($schema);
56
        $processor->processPayload("mutation{ echo(date: \"2016-11-25 09:53am\") }");
57
        $res = $processor->getResponseData();
58
59
        self::assertCount(1, $res, "Invalid response array received"); //only data expected
60
61
        self::assertNotNull($res['data']['echo'], "Invalid echo response received during mutation of date parameter");
62
63
        self::assertEquals("2016-11-25 09:53am", $res['data']['echo']);
64
    }
65
66 View Code Duplication
    public function testMutatingDateTimeWithExplicitNullParameter()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
67
    {
68
        $schema = new Issue90Schema();
69
        $processor = new Processor($schema);
70
        $processor->processPayload("mutation{ echo(date: null) }");
71
        $res = $processor->getResponseData();
72
73
        self::assertCount(1, $res, "Invalid response array received"); //only data expected
74
        self::assertNull($res['data']['echo'], "Invalid echo response received during mutation of date parameter with explicit null value");
75
    }
76
}