Completed
Pull Request — master (#371)
by Beñat
15:53
created

ProjectsResolverTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 83
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testProjectsFilteredByNameResolver() 0 10 1
B projectsResolver() 0 35 1
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace Kreta\TaskManager\Tests\Integration\GraphQl\Query\Projects;
16
17
use Lakion\ApiTestCase\JsonApiTestCase;
18
19
class ProjectsResolverTest extends JsonApiTestCase
20
{
21
//    public function testProjectsResolver()
0 ignored issues
show
Unused Code Comprehensibility introduced by
46% 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...
22
//    {
23
//        $this->projectsResolver(
24
//            'access-token-1',
25
//            [
26
//                'name' => '',
27
//            ],
28
//            '/projects'
29
//        );
30
//    }
31
//
32
    public function testProjectsFilteredByNameResolver()
33
    {
34
        $this->projectsResolver(
35
            'access-token-1',
36
            [
37
                'name' => '2',
38
            ],
39
            '/projects_filtered'
40
        );
41
    }
42
43
//    public function testProjectsWithAfter3AndFirst2()
0 ignored issues
show
Unused Code Comprehensibility introduced by
46% 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...
44
//    {
45
//        $this->projectsResolver(
46
//            'access-token-1',
47
//            [
48
//                'after' => '3',
49
//                'first' => '2',
50
//            ],
51
//            '/projects_paginated'
52
//        );
53
//    }
54
//
55
//    public function testProjectsWithOtherUserResolver()
56
//    {
57
//        $this->projectsResolver(
58
//            'access-token-2',
59
//            [
60
//                'name' => '',
61
//            ],
62
//            '/projects_of_user2'
63
//        );
64
//    }
65
//
66
    private function projectsResolver($token, $projectConnectionInput, $jsonResult)
67
    {
68
        $this->client->request('POST', '/?access_token=' . $token, [
69
            'query'       => <<<EOF
70
query ProjectsQueryRequest(\$projectConnectionInput: ProjectConnectionInput!) {
71
  projects(projectConnectionInput: \$projectConnectionInput) {
72
    totalCount,
73
    edges {
74
      node {
75
        id,
76
        name,
77
        slug,
78
        organization {
79
          id,
80
          name,
81
          slug,
82
          owners {
83
            id
84
          },
85
          organization_members {
86
            id
87
          }
88
        }
89
      }
90
    }
91
  }
92
}
93
EOF
94
            , 'variables' => ['projectConnectionInput' => $projectConnectionInput],
95
        ]);
96
97
        $response = $this->client->getResponse();
98
99
        $this->assertResponse($response, 'graphql/query/project' . $jsonResult);
100
    }
101
}
102