Completed
Pull Request — master (#17)
by Pavel
10:35
created

RouteAccessibilityTest::testRequestWasSuccessful()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 3
1
<?php
2
3
namespace ScayTrase\Api\Cruds\Tests\Configuration;
4
5
use ScayTrase\Api\Cruds\Tests\AbstractDbAwareTest;
6
use ScayTrase\Api\Cruds\Tests\Unit\StaticDbTestTrait;
7
use Symfony\Component\BrowserKit\Client;
8
9
class RouteAccessibilityTest extends AbstractDbAwareTest
10
{
11
    /** @var Client */
12
    private static $client;
0 ignored issues
show
Unused Code introduced by
The property $client is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
13
14
    use StaticDbTestTrait;
15
16
    public function getRequests()
17
    {
18
        return [
19
            'create' => ['/api/entity/my-entity/create', 'POST', ['data' => ['publicApiField' => 'my-value']]],
20
            'get'    => ['/api/entity/my-entity/get', 'GET', ['identifier' => 1]],
21
            'update' => [
22
                '/api/entity/my-entity/update',
23
                'POST',
24
                [
25
                    'identifier' => 1,
26
                    'data'       => [
27
                        'publicApiField' => 'my-updated-value',
28
                        'parent'         => null,
29
                    ],
30
                ],
31
            ],
32
            'search' => ['/api/entity/my-entity/search', 'GET', ['criteria' => ['id' => 1]]],
33
            'count'  => ['/api/entity/my-entity/count', 'GET', ['criteria' => ['id' => 1]]],
34
            'delete' => ['/api/entity/my-entity/delete', 'POST', ['identifier' => 1]],
35
        ];
36
    }
37
38
    /**
39
     * @dataProvider getRequests
40
     *
41
     * @param string $path
42
     * @param string $method
43
     * @param array  $args
44
     */
45
    public function testRequestWasSuccessful($path, $method, array $args = [])
46
    {
47
        self::$client->request($method, $path, $args);
48
        self::assertTrue(self::$client->getResponse()->isSuccessful());
49
    }
50
}
51