Add some more functional tests.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-06-13 18:31:39 -05:00
parent 13daec857c
commit f7f2755f58
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
2 changed files with 66 additions and 1 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}