Completed
Push — signal_search_issues ( 5556b2...f328ba )
by André
63:06 queued 07:22
created

RootTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testLoadRootResource() 0 7 1
A testCatchAll() 0 11 1
A getRandomUriSet() 0 8 1
1
<?php
2
3
/**
4
 * File containing the Functional\RootTest class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 *
9
 * @version //autogentag//
10
 */
11
namespace eZ\Bundle\EzPublishRestBundle\Tests\Functional;
12
13
use eZ\Bundle\EzPublishRestBundle\Tests\Functional\TestCase as RESTFunctionalTestCase;
14
15
class RootTest extends RESTFunctionalTestCase
16
{
17
    /**
18
     * @covers GET /
19
     */
20
    public function testLoadRootResource()
21
    {
22
        $response = $this->sendHttpRequest(
23
            $this->createHttpRequest('GET', '/api/ezp/v2/')
24
        );
25
        self::assertHttpResponseCodeEquals($response, 200);
26
    }
27
28
    /**
29
     * @dataProvider getRandomUriSet
30
     * @covers GET /<wrongUri>
31
     */
32
    public function testCatchAll($uri)
0 ignored issues
show
Unused Code introduced by
The parameter $uri is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
33
    {
34
        self::markTestSkipped('@todo fixme');
35
        $response = $this->sendHttpRequest(
36
            $this->createHttpRequest('GET', '/api/ezp/v2/' . uniqid('rest'), '', 'Stuff+json')
37
        );
38
        self::assertHttpResponseCodeEquals($response, 404);
39
        $responseArray = json_decode($response->getContent(), true);
40
        self::assertArrayHasKey('ErrorMessage', $responseArray);
41
        self::assertEquals('No such route', $responseArray['ErrorMessage']['errorDescription']);
42
    }
43
44
    public function getRandomUriSet()
45
    {
46
        return array(
47
            array('/api/ezp/v2/randomUri'),
48
            array('/api/ezp/v2/randomUri/level/two'),
49
            array('/api/ezp/v2/randomUri/with/arguments?arg=argh'),
50
        );
51
    }
52
}
53