2019-08-09 16:52:56 +00:00
|
|
|
<?php
|
2019-10-11 01:22:02 +00:00
|
|
|
|
2019-08-09 16:52:56 +00:00
|
|
|
class C02_Station_MediaCest extends CestAbstract
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @before setupComplete
|
|
|
|
* @before login
|
|
|
|
*/
|
|
|
|
public function editMedia(FunctionalTester $I)
|
|
|
|
{
|
|
|
|
$I->wantTo('Upload a song to a station.');
|
|
|
|
|
|
|
|
$station_id = $this->test_station->getId();
|
|
|
|
|
2020-02-06 02:35:13 +00:00
|
|
|
$test_song_orig = $this->settings[\App\Settings::BASE_DIR] . '/resources/error.mp3';
|
2019-08-09 16:52:56 +00:00
|
|
|
$test_song = tempnam(sys_get_temp_dir(), 'azuracast');
|
|
|
|
copy($test_song_orig, $test_song);
|
|
|
|
|
|
|
|
$test_file = [
|
2019-10-11 01:22:02 +00:00
|
|
|
'tmp_name' => $test_song,
|
|
|
|
'name' => basename($test_song),
|
|
|
|
'type' => 'audio/mpeg',
|
|
|
|
'size' => filesize($test_song),
|
|
|
|
'error' => \UPLOAD_ERR_OK,
|
2019-08-09 16:52:56 +00:00
|
|
|
];
|
|
|
|
|
2019-10-11 01:22:02 +00:00
|
|
|
$I->sendPOST('/api/station/' . $station_id . '/files/upload', [
|
2019-08-09 16:52:56 +00:00
|
|
|
'file' => '',
|
2019-10-11 01:22:02 +00:00
|
|
|
'csrf' => '', // CSRF disabled in testing.
|
2019-08-09 16:52:56 +00:00
|
|
|
'flowIdentifier' => 'uploadtest',
|
|
|
|
'flowChunkNumber' => 1,
|
|
|
|
'flowCurrentChunkSize' => filesize($test_song),
|
|
|
|
'flowFilename' => 'error.mp3',
|
|
|
|
'flowTotalSize' => filesize($test_song),
|
|
|
|
'flowTotalChunks' => 1,
|
|
|
|
], [
|
2019-10-11 01:22:02 +00:00
|
|
|
'file_data' => $test_file,
|
2019-08-09 16:52:56 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
$I->seeResponseContainsJson([
|
|
|
|
'success' => true,
|
|
|
|
]);
|
|
|
|
|
2019-10-11 01:22:02 +00:00
|
|
|
$I->sendGET('/api/station/' . $station_id . '/files/list');
|
2019-08-09 16:52:56 +00:00
|
|
|
|
|
|
|
$I->seeResponseContainsJson([
|
|
|
|
'media_name' => 'AzuraCast.com - AzuraCast is Live!',
|
|
|
|
]);
|
|
|
|
|
2019-10-11 01:22:02 +00:00
|
|
|
$I->amOnPage('/station/' . $station_id . '/files');
|
2019-08-09 16:52:56 +00:00
|
|
|
|
|
|
|
$I->see('Music Files');
|
|
|
|
}
|
|
|
|
}
|