--- a/server/src/tests/Controllers/ThemeControllerTest.php Sat Jun 10 22:43:58 2017 +0200
+++ b/server/src/tests/Controllers/ThemeControllerTest.php Mon Jun 12 14:53:59 2017 +0200
@@ -107,8 +107,10 @@
]
]
]);
- $this->get('/api/v1/stats/themes/')->assertTrue($this->response->isOk(), $this->response->content());
- $this->seeJsonEquals(["themes" => [
+ $response = $this->get('/api/v1/stats/themes/');
+ $response
+ ->assertStatus(200)
+ ->assertJson(["themes" => [
"http://ark.bnf.fr/ark:/12148/cb13318415c" => ['label' => 'professions', 'count' => 1412 ],
"http://ark.bnf.fr/ark:/12148/cb16604691s" => ['label' => 'travail non rémunéré', 'count' => 1092 ],
"http://ark.bnf.fr/ark:/12148/cb119339867" => ['label' => 'famille', 'count' => 1050 ],
@@ -212,8 +214,10 @@
]
]
]);
- $this->get('/api/v1/stats/themes/?filter=all')->assertTrue($this->response->isOk(), $this->response->content());
- $this->seeJsonEquals(["themes" => [
+ $response = $this->get('/api/v1/stats/themes/?filter=all');
+ $response
+ ->assertStatus(200)
+ ->assertJson(["themes" => [
"http://ark.bnf.fr/ark:/12148/cb13318415c" => ['label' => 'professions', 'count' => 1412 ],
"http://ark.bnf.fr/ark:/12148/cb16604691s" => ['label' => 'travail non rémunéré', 'count' => 1092 ],
"http://ark.bnf.fr/ark:/12148/cb119339867" => ['label' => 'famille', 'count' => 1050 ],
@@ -296,8 +300,10 @@
]
]
]);
- $this->get('/api/v1/stats/themes/?filter=lexvo')->assertTrue($this->response->isOk(), $this->response->content());
- $this->seeJsonEquals(["themes" => [
+ $response = $this->get('/api/v1/stats/themes/?filter=lexvo');
+ $response
+ ->assertStatus(200)
+ ->assertJson(["themes" => [
"http://lexvo.org/id/iso639-3/fra" => ['label' => 'Français', 'count' => 1002 ],
"http://lexvo.org/id/iso639-3/bzh" => ['label' => 'Breton', 'count' => 992 ]
], "meta" => ['total' => 999]]);
@@ -373,7 +379,7 @@
->once()
->with($this->getOrderQuery(['_count' => 'desc']))
->andReturn($this->getRespSort());
- $this->get('/api/v1/stats/themes/')->assertTrue($this->response->isOk(), $this->response->content());
+ $this->get('/api/v1/stats/themes/')->assertStatus(200);
}
@@ -382,7 +388,7 @@
->once()
->with($this->getOrderQuery(['_count' => 'asc']))
->andReturn($this->getRespSort());
- $this->get('/api/v1/stats/themes/?sort=-count')->assertTrue($this->response->isOk(), $this->response->content());
+ $this->get('/api/v1/stats/themes/?sort=-count')->assertStatus(200);
}
public function testIndexSortLabel() {
@@ -390,7 +396,7 @@
->once()
->with($this->getOrderQuery(['_term' => 'asc']))
->andReturn($this->getRespSort());
- $this->get('/api/v1/stats/themes/?sort=label')->assertTrue($this->response->isOk(), $this->response->content());
+ $this->get('/api/v1/stats/themes/?sort=label')->assertStatus(200);
}
public function testIndexSortAlphabetical() {
@@ -398,7 +404,7 @@
->once()
->with($this->getOrderQuery(['_term' => 'asc']))
->andReturn($this->getRespSort());
- $this->get('/api/v1/stats/themes/?sort=alphabetical')->assertTrue($this->response->isOk(), $this->response->content());
+ $this->get('/api/v1/stats/themes/?sort=alphabetical')->assertStatus(200);
}
public function testIndexSortLabelReverse() {
@@ -406,7 +412,7 @@
->once()
->with($this->getOrderQuery(['_term' => 'desc']))
->andReturn($this->getRespSort());
- $this->get('/api/v1/stats/themes/?sort=-label')->assertTrue($this->response->isOk(), $this->response->content());
+ $this->get('/api/v1/stats/themes/?sort=-label')->assertStatus(200);
}
@@ -497,8 +503,8 @@
]
]
]);
- $this->get('/api/v1/stats/themes/?limit=3')->assertTrue($this->response->isOk(), $this->response->content());
- $this->seeJsonEquals(["themes" => [
+ $response = $this->get('/api/v1/stats/themes/?limit=3')->assertStatus(200);
+ $response->assertJson(["themes" => [
"http://ark.bnf.fr/ark:/12148/cb13318415c" => ['label' => 'professions', 'count' => 1412 ],
"http://ark.bnf.fr/ark:/12148/cb16604691s" => ['label' => 'travail non rémunéré', 'count' => 1092 ],
"http://ark.bnf.fr/ark:/12148/cb119339867" => ['label' => 'famille', 'count' => 1050 ]
@@ -593,8 +599,8 @@
]
]
]);
- $this->get('/api/v1/stats/themes/?limit=3&index=1')->assertTrue($this->response->isOk(), $this->response->content());
- $this->seeJsonEquals(["themes" => [
+ $response = $this->get('/api/v1/stats/themes/?limit=3&index=1')->assertStatus(200);
+ $response->assertJson(["themes" => [
"http://ark.bnf.fr/ark:/12148/cb11932889r" => ['label' => 'oiseaux', 'count' => 1003 ],
"http://ark.bnf.fr/ark:/12148/cb11932496x" => ['label' => 'météorologie', 'count' => 1001 ],
"http://ark.bnf.fr/ark:/12148/cb11933145f" => ['label' => 'plantes', 'count' => 995 ]
@@ -689,8 +695,8 @@
]
]
]);
- $this->get('/api/v1/stats/themes/?limit=3&index=2')->assertTrue($this->response->isOk(), $this->response->content());
- $this->seeJsonEquals(["themes" => [
+ $response = $this->get('/api/v1/stats/themes/?limit=3&index=2')->assertStatus(200);
+ $response->assertJson(["themes" => [
"http://ark.bnf.fr/ark:/12148/cb11930908q" => ['label' => 'animaux sauvages', 'count' => 989 ],
"http://ark.bnf.fr/ark:/12148/cb11934786x" => ['label' => 'arbres', 'count' => 989 ]
], "meta" => ['total' => 999]]);