| @@ 88-117 (lines=30) @@ | ||
| 85 | * |
|
| 86 | * @return void |
|
| 87 | */ |
|
| 88 | public function testGeneratedPagingHeadersNoRql() |
|
| 89 | { |
|
| 90 | $this->loadFixtures( |
|
| 91 | [ |
|
| 92 | 'Graviton\CoreBundle\DataFixtures\MongoDB\LoadAppDataExceedSinglePageLimit' |
|
| 93 | ], |
|
| 94 | null, |
|
| 95 | 'doctrine_mongodb' |
|
| 96 | ); |
|
| 97 | ||
| 98 | $client = static::createRestClient(); |
|
| 99 | $client->request('GET', '/core/app/'); |
|
| 100 | ||
| 101 | $response = $client->getResponse(); |
|
| 102 | ||
| 103 | $this->assertContains( |
|
| 104 | '<http://localhost/core/app/?limit(10%2C0)>; rel="self"', |
|
| 105 | $response->headers->get('Link') |
|
| 106 | ); |
|
| 107 | ||
| 108 | $this->assertContains( |
|
| 109 | '<http://localhost/core/app/?limit(10%2C10)>; rel="next"', |
|
| 110 | $response->headers->get('Link') |
|
| 111 | ); |
|
| 112 | ||
| 113 | $this->assertContains( |
|
| 114 | '<http://localhost/core/app/?limit(10%2C10)>; rel="last"', |
|
| 115 | $response->headers->get('Link') |
|
| 116 | ); |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * test if we can get list of apps, paged and with filters.. |
|
| @@ 124-146 (lines=23) @@ | ||
| 121 | * |
|
| 122 | * @return void |
|
| 123 | */ |
|
| 124 | public function testGetAppWithFilteringAndPaging() |
|
| 125 | { |
|
| 126 | $client = static::createRestClient(); |
|
| 127 | $client->request('GET', '/core/app/?eq(showInMenu,true)&limit(1)'); |
|
| 128 | $response = $client->getResponse(); |
|
| 129 | ||
| 130 | $this->assertEquals(1, count($client->getResults())); |
|
| 131 | ||
| 132 | $this->assertContains( |
|
| 133 | '<http://localhost/core/app/?eq(showInMenu%2Ctrue)&limit(1)>; rel="self"', |
|
| 134 | $response->headers->get('Link') |
|
| 135 | ); |
|
| 136 | ||
| 137 | $this->assertContains( |
|
| 138 | '<http://localhost/core/app/?eq(showInMenu%2Ctrue)&limit(1%2C1)>; rel="next"', |
|
| 139 | $response->headers->get('Link') |
|
| 140 | ); |
|
| 141 | ||
| 142 | $this->assertContains( |
|
| 143 | '<http://localhost/core/app/?eq(showInMenu%2Ctrue)&limit(1%2C1)>; rel="last"', |
|
| 144 | $response->headers->get('Link') |
|
| 145 | ); |
|
| 146 | } |
|
| 147 | ||
| 148 | /** |
|
| 149 | * rql limit() should *never* be overwritten by default value |
|