| @@ 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 |
|
| @@ 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 |
|
| @@ 48-56 (lines=9) @@ | ||
| 45 | * |
|
| 46 | * @return void |
|
| 47 | */ |
|
| 48 | public function testPutMethodIncludeRequiredTranslatable($data, $complainField, $errorMessage) |
|
| 49 | { |
|
| 50 | $client = static::createRestClient(); |
|
| 51 | $client->put('/testcase/translatable-required/testdata', $data); |
|
| 52 | ||
| 53 | $this->assertEquals(Response::HTTP_BAD_REQUEST, $client->getResponse()->getStatusCode()); |
|
| 54 | $this->assertSame($complainField, $client->getResults()[0]->propertyPath); |
|
| 55 | $this->assertSame($errorMessage, $client->getResults()[0]->message); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Posts that the backend shall accept |
|
| @@ 974-980 (lines=7) @@ | ||
| 971 | * @dataProvider rqlDataProvider |
|
| 972 | * @return void |
|
| 973 | */ |
|
| 974 | public function testTrigger301($url, $redirectUrl) |
|
| 975 | { |
|
| 976 | $client = static::createRestClient(); |
|
| 977 | $client->request('GET', $url); |
|
| 978 | $this->assertEquals(301, $client->getResponse()->getStatusCode()); |
|
| 979 | $this->assertEquals($redirectUrl, $client->getResponse()->headers->get('Location')); |
|
| 980 | } |
|
| 981 | ||
| 982 | /** |
|
| 983 | * Provides urls for the testTrigger301() test. |
|
| @@ 241-253 (lines=13) @@ | ||
| 238 | * |
|
| 239 | * @return void |
|
| 240 | */ |
|
| 241 | public function testFindByAppRef($ref, $url, $count) |
|
| 242 | { |
|
| 243 | $url = sprintf( |
|
| 244 | '/core/module/?%s=%s', |
|
| 245 | $this->encodeRqlString($ref), |
|
| 246 | $this->encodeRqlString($url) |
|
| 247 | ); |
|
| 248 | ||
| 249 | $client = static::createRestClient(); |
|
| 250 | $client->request('GET', $url); |
|
| 251 | $results = $client->getResults(); |
|
| 252 | $this->assertCount($count, $results); |
|
| 253 | } |
|
| 254 | ||
| 255 | /** |
|
| 256 | * @return array |
|
| @@ 48-56 (lines=9) @@ | ||
| 45 | * |
|
| 46 | * @return void |
|
| 47 | */ |
|
| 48 | public function testRecordOriginHandlingOnCreate($entity, $expectedStatus, $expectedResponse) |
|
| 49 | { |
|
| 50 | $client = static::createRestClient(); |
|
| 51 | $client->post('/person/customer/', $entity); |
|
| 52 | ||
| 53 | $response = $client->getResponse(); |
|
| 54 | $this->assertEquals($expectedStatus, $response->getStatusCode()); |
|
| 55 | $this->assertEquals($expectedResponse, $client->getResults()); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * tests for the case if user doesn't provide an id in payload.. constraint |
|
| @@ 242-249 (lines=8) @@ | ||
| 239 | * @param integer $limit limit value that should fail |
|
| 240 | * @return void |
|
| 241 | */ |
|
| 242 | public function testInvalidPagingPageSize($limit) |
|
| 243 | { |
|
| 244 | $client = static::createRestClient(); |
|
| 245 | $client->request('GET', sprintf('/core/app/?limit(%s)', $limit)); |
|
| 246 | ||
| 247 | $this->assertEquals(Response::HTTP_BAD_REQUEST, $client->getResponse()->getStatusCode()); |
|
| 248 | $this->assertContains('negative or null limit in rql', $client->getResults()->message); |
|
| 249 | } |
|
| 250 | ||
| 251 | /** |
|
| 252 | * page size test provides |
|