Completed
Push — master ( ce0ced...50615c )
by Alexandr
02:46
created

TestScalarDataProvider::getIdTestData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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