Add some more functional tests.
This commit is contained in:
parent
13daec857c
commit
f7f2755f58
|
@ -12,9 +12,12 @@ class Api_Stations_PodcastsCest extends CestAbstract
|
|||
|
||||
$station = $this->getTestStation();
|
||||
|
||||
// Test CRUD for the podcast itself
|
||||
$listUrl = '/api/station/' . $station->getId() . '/podcasts';
|
||||
|
||||
$this->testCrudApi(
|
||||
$I,
|
||||
'/api/station/' . $station->getId() . '/podcasts',
|
||||
$listUrl,
|
||||
[
|
||||
'title' => 'My Awesome Podcast',
|
||||
'description' => 'A functional test podcast.',
|
||||
|
@ -25,5 +28,39 @@ class Api_Stations_PodcastsCest extends CestAbstract
|
|||
'language' => 'de',
|
||||
]
|
||||
);
|
||||
|
||||
// Test CRUD for the episodes
|
||||
$I->sendPOST(
|
||||
$listUrl,
|
||||
[
|
||||
'title' => 'Episode Test Podcast',
|
||||
'description' => 'A podcast with episodes.',
|
||||
'language' => 'en',
|
||||
]
|
||||
);
|
||||
$I->seeResponseCodeIs(200);
|
||||
|
||||
$newRecordSelfLink = ($I->grabDataFromResponseByJsonPath('links.self'))[0];
|
||||
$episodesLink = ($I->grabDataFromResponseByJsonPath('links.episodes'))[0];
|
||||
|
||||
$this->testCrudApi(
|
||||
$I,
|
||||
$episodesLink,
|
||||
[
|
||||
'title' => 'My Awesome Podcast Episode',
|
||||
'description' => 'A functional test podcast episode!',
|
||||
'explicit' => false,
|
||||
],
|
||||
[
|
||||
'title' => 'My Awesome Suddenly Explicit Podcast Episode',
|
||||
'explicit' => true,
|
||||
]
|
||||
);
|
||||
|
||||
// Delete Record
|
||||
$I->sendDELETE($newRecordSelfLink);
|
||||
|
||||
$I->sendGET($newRecordSelfLink);
|
||||
$I->seeResponseCodeIs(404);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
class Api_Stations_ReportsCest extends CestAbstract
|
||||
{
|
||||
/**
|
||||
* @before setupComplete
|
||||
* @before login
|
||||
*/
|
||||
public function viewReports(FunctionalTester $I): void
|
||||
{
|
||||
$I->wantTo('View various station reports via API.');
|
||||
|
||||
$station = $this->getTestStation();
|
||||
$uriBase = '/api/station/' . $station->getId();
|
||||
|
||||
$I->sendGet($uriBase . '/reports/overview/charts');
|
||||
|
||||
$I->seeResponseCodeIs(200);
|
||||
|
||||
$I->sendGet($uriBase . '/reports/overview/best-and-worst');
|
||||
|
||||
$I->seeResponseCodeIs(200);
|
||||
|
||||
$I->sendGet($uriBase . '/reports/overview/most-played');
|
||||
|
||||
$I->seeResponseCodeIs(200);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue