src/Graviton/CoreBundle/Tests/Controller/TranslatableArrayControllerTest.php 3 locations
|
@@ 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 |
src/Graviton/CoreBundle/Tests/Services/ReadOnlyServiceTest.php 1 location
|
@@ 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 |
src/Graviton/CoreBundle/Tests/Controller/TranslatableRequiredTest.php 1 location
|
@@ 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 |
src/Graviton/CoreBundle/Tests/Controller/ShowcaseControllerTest.php 1 location
|
@@ 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. |
src/Graviton/SchemaBundle/Tests/Controller/RecordOriginConstraintTest.php 1 location
|
@@ 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 |
src/Graviton/CoreBundle/Tests/Controller/AppControllerTest.php 1 location
|
@@ 243-250 (lines=8) @@
|
| 240 |
|
* @param integer $limit limit value that should fail |
| 241 |
|
* @return void |
| 242 |
|
*/ |
| 243 |
|
public function testInvalidPagingPageSize($limit) |
| 244 |
|
{ |
| 245 |
|
$client = static::createRestClient(); |
| 246 |
|
$client->request('GET', sprintf('/core/app/?limit(%s)', $limit)); |
| 247 |
|
|
| 248 |
|
$this->assertEquals(Response::HTTP_BAD_REQUEST, $client->getResponse()->getStatusCode()); |
| 249 |
|
$this->assertContains('negative or null limit in rql', $client->getResults()->message); |
| 250 |
|
} |
| 251 |
|
|
| 252 |
|
/** |
| 253 |
|
* page size test provides |
src/Graviton/CoreBundle/Tests/Controller/MainControllerTest.php 1 location
|
@@ 48-58 (lines=11) @@
|
| 45 |
|
* |
| 46 |
|
* @return void |
| 47 |
|
*/ |
| 48 |
|
public function testVersionHeader() |
| 49 |
|
{ |
| 50 |
|
$client = static::createRestClient(); |
| 51 |
|
$client->request('GET', '/'); |
| 52 |
|
|
| 53 |
|
$composer = new CoreUtils($this->getContainer()->getParameter('graviton.core.version.data')); |
| 54 |
|
|
| 55 |
|
$response = $client->getResponse(); |
| 56 |
|
|
| 57 |
|
$this->assertEquals($composer->getVersionInHeaderFormat(), $response->headers->get('X-Version')); |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
/** |
| 61 |
|
* check for app link in header |
src/Graviton/AnalyticsBundle/Tests/Controller/DefaultControllerTest.php 1 location
|
@@ 41-48 (lines=8) @@
|
| 38 |
|
* test options request |
| 39 |
|
* @return void |
| 40 |
|
*/ |
| 41 |
|
public function testOptions() |
| 42 |
|
{ |
| 43 |
|
$client = static::createRestClient(); |
| 44 |
|
$client->request('OPTIONS', '/analytics/schema/app'); |
| 45 |
|
$this->assertEquals(Response::HTTP_NO_CONTENT, $client->getResponse()->getStatusCode()); |
| 46 |
|
$this->assertEquals('GET, OPTIONS', $client->getResponse()->headers->get('Access-Control-Allow-Methods')); |
| 47 |
|
$this->assertEmpty($client->getResults()); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
/** |
| 51 |
|
* Testing basic functionality |
src/Graviton/CoreBundle/Tests/Controller/ModuleControllerTest.php 1 location
|
@@ 275-287 (lines=13) @@
|
| 272 |
|
* |
| 273 |
|
* @return void |
| 274 |
|
*/ |
| 275 |
|
public function testFindByAppRef($ref, $url, $count) |
| 276 |
|
{ |
| 277 |
|
$url = sprintf( |
| 278 |
|
'/core/module/?%s=%s', |
| 279 |
|
$this->encodeRqlString($ref), |
| 280 |
|
$this->encodeRqlString($url) |
| 281 |
|
); |
| 282 |
|
|
| 283 |
|
$client = static::createRestClient(); |
| 284 |
|
$client->request('GET', $url); |
| 285 |
|
$results = $client->getResults(); |
| 286 |
|
$this->assertCount($count, $results); |
| 287 |
|
} |
| 288 |
|
|
| 289 |
|
/** |
| 290 |
|
* @return array |
src/Graviton/CoreBundle/Tests/Controller/PrimitiveArrayControllerTest.php 2 locations
|
@@ 60-69 (lines=10) @@
|
| 57 |
|
* |
| 58 |
|
* @return void |
| 59 |
|
*/ |
| 60 |
|
public function testItemSchema() |
| 61 |
|
{ |
| 62 |
|
$client = static::createRestClient(); |
| 63 |
|
$client->request('GET', '/schema/testcase/primitivearray/item'); |
| 64 |
|
$this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode()); |
| 65 |
|
|
| 66 |
|
$schema = $client->getResults(); |
| 67 |
|
$this->assertEquals('object', $schema->type); |
| 68 |
|
$this->assertItemSchema($schema); |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
/** |
| 72 |
|
* Test collection schema |
|
@@ 93-101 (lines=9) @@
|
| 90 |
|
* |
| 91 |
|
* @return void |
| 92 |
|
*/ |
| 93 |
|
public function testCheckGetOne() |
| 94 |
|
{ |
| 95 |
|
$client = static::createRestClient(); |
| 96 |
|
$client->request('GET', '/testcase/primitivearray/testdata'); |
| 97 |
|
$this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode()); |
| 98 |
|
$this->assertNotEmpty($client->getResults()); |
| 99 |
|
|
| 100 |
|
$this->assertFixtureData($client->getResults()); |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
/** |
| 104 |
|
* Test GET all method |