Completed
Push — master ( 589f5d...2e0cd6 )
by Pavel
07:02
created

RouteAccessibilityTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testEntityRouting() 0 22 1
A doRequest() 0 5 1
1
<?php
2
3
namespace ScayTrase\Api\Cruds\Tests;
4
5
class RouteAccessibilityTest extends AbstractCrudsWebTest
6
{
7
    /**
8
     * @dataProvider getKernelClasses
9
     *
10
     * @param $kernel
11
     */
12
    public function testEntityRouting($kernel)
13
    {
14
        self::createAndBootKernel($kernel);
15
        self::configureDb();
16
17
        $this->doRequest('/api/entity/my-entity/create', 'POST', ['data' => ['publicApiField' => 'my-value']]);
18
        $this->doRequest('/api/entity/my-entity/read', 'GET', ['identifier' => 1]);
19
        $this->doRequest(
20
            '/api/entity/my-entity/update',
21
            'POST',
22
            [
23
                'identifier' => 1,
24
                'data'       => [
25
                    'publicApiField' => 'my-updated-value',
26
                    'parent'         => null,
27
                ],
28
            ]
29
        );
30
31
        $this->doRequest('/api/entity/my-entity/search', 'GET', ['criteria' => []]);
32
        $this->doRequest('/api/entity/my-entity/delete', 'POST', ['identifier' => 1]);
33
    }
34
35
    private function doRequest($path, $method, array $args = [])
36
    {
37
        $client = self::createClient();
38
        $client->request($method, $path, $args);
39
    }
40
}
41