Completed
Push — master ( e81cc5...330c26 )
by Portey
56:41 queued 37:11
created

TestScalarDataProvider::getDatetimetzTestData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/*
3
* This file is a part of graphql-youshido project.
4
*
5
* @author Alexandr Viniychuk <[email protected]>
6
* created: 11/28/15 12:05 PM
7
*/
8
9
namespace Youshido\Tests\DataProvider;
10
11
class TestScalarDataProvider
12
{
13
14
15
    public static function getsList()
16
    {
17
        return [
18
            "Int",
19
            "String",
20
            "Boolean",
21
            "Float",
22
            "Id"
23
        ];
24
    }
25
26
    public static function getIntTestData()
27
    {
28
        /** input, serialization, isValid */
29
        return [
30
            [1, 1, true],
31
            [0, 0, true],
32
            [-1, -1, true],
33
            [0.1, 0, false],
34
            [1.1, 1, false],
35
            [1e5, 100000, false],
36
            ["1", 1, false],
37
            [9876504321, 9876504321, true],
38
            [-9876504321, -9876504321, true],
39
            [1e100, null, false],
40
            [-1e100, null, false],
41
            ['-1.1', -1, false],
42
            ['one', null, false],
43
            [false, 0, false],
44
            [true, 1, false],
45
        ];
46
    }
47
48
    public static function getFloatTestData()
49
    {
50
        return [
51
            [1, 1.0, true],
52
            [0, 0.0, true],
53
            [-1, -1, true],
54
            [0.1, 0.1, true],
55
            [1.1, 1.1, true],
56
            ['-1.1', -1.1, false],
57
            ['one', null, false],
58
            [false, 0.0, false],
59
            [true, 1.0, false],
60
        ];
61
    }
62
63
    public static function getStringTestData()
64
    {
65
        return [
66
            ["string", "string", true],
67
            [1, "1", false],
68
            [1.1, "1.1", false],
69
            [true, "true", false],
70
            [false, "false", false],
71
        ];
72
    }
73
74
    public static function getBooleanTestData()
75
    {
76
        return [
77
            ["string", true, false],
78
            ["", false, false],
79
            [1, true, false],
80
            [0, false, false],
81
            [null, false, false],
82
            [true, true, true],
83
            [false, false, true],
84
        ];
85
    }
86
87
    public static function getIdTestData()
88
    {
89
        return [
90
            ["string-id", "string-id", true],
91
            ["", null, false],
92
            [1, "1", true],
93
        ];
94
    }
95
96 View Code Duplication
    public static function getDatetimeTestData()
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...
97
    {
98
        return [
99
            [null, null, false],
100
            [new \DateTime('now'), date('Y-m-d H:i:s'), true],
101
        ];
102
    }
103
104
    public static function getDatetimetzTestData()
105
    {
106
        return [
107
            [null, null, false],
108
        ];
109
    }
110
111 View Code Duplication
    public static function getDateTestData()
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...
112
    {
113
        return [
114
            [null, null, false],
115
            [new \DateTime('now'), date('Y-m-d'), true],
116
        ];
117
    }
118
119
120
    public static function getTimestampTestData()
121
    {
122
        return [
123
//            [null, null, false],
0 ignored issues
show
Unused Code Comprehensibility introduced by
73% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
124
            [new \DateTime('now'), time(), true],
125
        ];
126
    }
127
128
}