| @@ 44-53 (lines=10) @@ | ||
| 41 | * |
|
| 42 | * @return void |
|
| 43 | */ |
|
| 44 | public function testItemSchema() |
|
| 45 | { |
|
| 46 | $client = static::createRestClient(); |
|
| 47 | $client->request('GET', '/schema/testcase/primitivearray/item'); |
|
| 48 | $this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode()); |
|
| 49 | ||
| 50 | $schema = $client->getResults(); |
|
| 51 | $this->assertEquals('object', $schema->type); |
|
| 52 | $this->assertItemSchema($schema); |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * Test collection schema |
|
| @@ 77-85 (lines=9) @@ | ||
| 74 | * |
|
| 75 | * @return void |
|
| 76 | */ |
|
| 77 | public function testCheckGetOne() |
|
| 78 | { |
|
| 79 | $client = static::createRestClient(); |
|
| 80 | $client->request('GET', '/testcase/primitivearray/testdata'); |
|
| 81 | $this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode()); |
|
| 82 | $this->assertNotEmpty($client->getResults()); |
|
| 83 | ||
| 84 | $this->assertFixtureData($client->getResults()); |
|
| 85 | } |
|
| 86 | ||
| 87 | /** |
|
| 88 | * Test GET all method |
|
| @@ 306-315 (lines=10) @@ | ||
| 303 | * |
|
| 304 | * @return void |
|
| 305 | */ |
|
| 306 | public function testCollectionHasNoRealId() |
|
| 307 | { |
|
| 308 | $client = static::createRestclient(); |
|
| 309 | $client->request('GET', '/schema/testcase/requiredhash/collection'); |
|
| 310 | ||
| 311 | $response = $client->getResponse(); |
|
| 312 | ||
| 313 | $this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); |
|
| 314 | $this->assertNotContains('realId', $response->getContent()); |
|
| 315 | } |
|
| 316 | } |
|
| 317 | ||
| @@ 898-904 (lines=7) @@ | ||
| 895 | * @dataProvider rqlDataProvider |
|
| 896 | * @return void |
|
| 897 | */ |
|
| 898 | public function testTrigger301($url, $redirectUrl) |
|
| 899 | { |
|
| 900 | $client = static::createRestClient(); |
|
| 901 | $client->request('GET', $url); |
|
| 902 | $this->assertEquals(301, $client->getResponse()->getStatusCode()); |
|
| 903 | $this->assertEquals($redirectUrl, $client->getResponse()->headers->get('Location')); |
|
| 904 | } |
|
| 905 | ||
| 906 | /** |
|
| 907 | * Provides urls for the testTrigger301() test. |
|
| @@ 50-59 (lines=10) @@ | ||
| 47 | * |
|
| 48 | * @return void |
|
| 49 | */ |
|
| 50 | public function testItemSchema() |
|
| 51 | { |
|
| 52 | $client = static::createRestClient(); |
|
| 53 | $this->getRequest($client, '/schema/testcase/translatable-array/item'); |
|
| 54 | $this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode()); |
|
| 55 | ||
| 56 | $schema = $client->getResults(); |
|
| 57 | $this->assertEquals('object', $schema->type); |
|
| 58 | $this->assertItemSchema($schema); |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * Test collection schema |
|
| @@ 83-91 (lines=9) @@ | ||
| 80 | * |
|
| 81 | * @return void |
|
| 82 | */ |
|
| 83 | public function testCheckGetOne() |
|
| 84 | { |
|
| 85 | $client = static::createRestClient(); |
|
| 86 | $this->getRequest($client, '/testcase/translatable-array/testdata'); |
|
| 87 | $this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode()); |
|
| 88 | $this->assertNotEmpty($client->getResults()); |
|
| 89 | ||
| 90 | $this->assertFixtureData($client->getResults()); |
|
| 91 | } |
|
| 92 | ||
| 93 | /** |
|
| 94 | * Test GET all method |
|
| @@ 98-106 (lines=9) @@ | ||
| 95 | * |
|
| 96 | * @return void |
|
| 97 | */ |
|
| 98 | public function testCheckGetAll() |
|
| 99 | { |
|
| 100 | $client = static::createRestClient(); |
|
| 101 | $this->getRequest($client, '/testcase/translatable-array/'); |
|
| 102 | $this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode()); |
|
| 103 | $this->assertCount(1, $client->getResults()); |
|
| 104 | ||
| 105 | $this->assertFixtureData($client->getResults()[0]); |
|
| 106 | } |
|
| 107 | ||
| 108 | /** |
|
| 109 | * Test POST method |
|
| @@ 41-51 (lines=11) @@ | ||
| 38 | * |
|
| 39 | * @return void |
|
| 40 | */ |
|
| 41 | public function testAllowedMethod() |
|
| 42 | { |
|
| 43 | $client = static::createRestClient(); |
|
| 44 | $client->request('GET', "/testcase/readonly/"); |
|
| 45 | ||
| 46 | $response = $client->getResponse(); |
|
| 47 | $result = $client->getResults(); |
|
| 48 | ||
| 49 | $this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); |
|
| 50 | $this->assertCount(2, $result); |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * test not allowed methods of a readOnly service |
|