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

RootTest::getRandomUriSet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
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