mirror of
https://github.com/koel/koel
synced 2024-12-27 04:53:08 +00:00
53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
<?php
|
|
|
|
use App\Events\LibraryChanged;
|
|
use App\Models\Album;
|
|
use App\Models\Artist;
|
|
use App\Models\Song;
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
|
|
|
class ObjectStorage_S3Test extends TestCase
|
|
{
|
|
use DatabaseTransactions, WithoutMiddleware;
|
|
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
}
|
|
|
|
public function testPut()
|
|
{
|
|
$this->post('api/os/s3/song', [
|
|
'bucket' => 'koel',
|
|
'key' => 'sample.mp3',
|
|
'tags' => [
|
|
'title' => 'A Koel Song',
|
|
'album' => 'Koel Testing Vol. 1',
|
|
'artist' => 'Koel',
|
|
'lyrics' => "When you wake up, turn your radio on, and you'll hear this simple song",
|
|
'duration' => 10,
|
|
'track' => 5,
|
|
],
|
|
])->seeInDatabase('songs', ['path' => 's3://koel/sample.mp3']);
|
|
}
|
|
|
|
public function testRemove()
|
|
{
|
|
$this->expectsEvents(LibraryChanged::class);
|
|
|
|
$this->post('api/os/s3/song', [
|
|
'bucket' => 'koel',
|
|
'key' => 'sample.mp3',
|
|
'tags' => [
|
|
'lyrics' => '',
|
|
'duration' => 10,
|
|
],
|
|
])->seeInDatabase('songs', ['path' => 's3://koel/sample.mp3']);
|
|
|
|
$this->delete('api/os/s3/song', [
|
|
'bucket' => 'koel',
|
|
'key' => 'sample.mp3',
|
|
])->notSeeInDatabase('songs', ['path' => 's3://koel/sample.mp3']);
|
|
}
|
|
}
|