Completed
Push — master ( 6cc2de...ecdd96 )
by Adrien
02:40
created

UtilsTest::providerGetPartialInputTypeName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLTests\Doctrine;
6
7
use GraphQL\Doctrine\Utils;
8
9
class UtilsTest extends \PHPUnit\Framework\TestCase
10
{
11
    public function providerGetTypeName(): array
12
    {
13
        return [
14
            ['\Blog\Model\Post', 'Post'],
15
            ['Blog\Model\Post', 'Post'],
16
            ['\Post', 'Post'],
17
            ['Post', 'Post'],
18
        ];
19
    }
20
21
    /**
22
     * @dataProvider providerGetTypeName
23
     *
24
     * @param string $input
25
     * @param string $expected
26
     */
27
    public function testGetTypeName(string $input, string $expected): void
28
    {
29
        self::assertSame($expected, Utils::getTypeName($input));
30
    }
31
32
    public function providerGetIDTypeName(): array
33
    {
34
        return [
35
            ['\Blog\Model\Post', 'PostID'],
36
            ['Blog\Model\Post', 'PostID'],
37
            ['\Post', 'PostID'],
38
            ['Post', 'PostID'],
39
        ];
40
    }
41
42
    /**
43
     * @dataProvider providerGetIDTypeName
44
     *
45
     * @param string $input
46
     * @param string $expected
47
     */
48
    public function testGetIDTypeName(string $input, string $expected): void
49
    {
50
        self::assertSame($expected, Utils::getIDTypeName($input));
51
    }
52
53
    public function providerGetInputTypeName(): array
54
    {
55
        return [
56
            ['\Blog\Model\Post', 'PostInput'],
57
            ['Blog\Model\Post', 'PostInput'],
58
            ['\Post', 'PostInput'],
59
            ['Post', 'PostInput'],
60
        ];
61
    }
62
63
    /**
64
     * @dataProvider providerGetInputTypeName
65
     *
66
     * @param string $input
67
     * @param string $expected
68
     */
69
    public function testGetInputTypeName(string $input, string $expected): void
70
    {
71
        self::assertSame($expected, Utils::getInputTypeName($input));
72
    }
73
74
    public function providerGetPartialInputTypeName(): array
75
    {
76
        return [
77
            ['\Blog\Model\Post', 'PostPartialInput'],
78
            ['Blog\Model\Post', 'PostPartialInput'],
79
            ['\Post', 'PostPartialInput'],
80
            ['Post', 'PostPartialInput'],
81
        ];
82
    }
83
84
    /**
85
     * @dataProvider providerGetPartialInputTypeName
86
     *
87
     * @param string $PartialInput
88
     * @param string $expected
89
     */
90
    public function testGetPartialInputTypeName(string $PartialInput, string $expected): void
91
    {
92
        self::assertSame($expected, Utils::getPartialInputTypeName($PartialInput));
93
    }
94
}
95