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) |
|
|
|
|
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
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.