mirror of
https://github.com/koel/koel
synced 2024-11-24 13:13:05 +00:00
39 lines
819 B
PHP
39 lines
819 B
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\Song;
|
|
use App\Services\YouTubeService;
|
|
use Exception;
|
|
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
|
use Mockery\MockInterface;
|
|
|
|
class YouTubeTest extends TestCase
|
|
{
|
|
use WithoutMiddleware;
|
|
|
|
/** @var YouTubeService|MockInterface */
|
|
private $youTubeService;
|
|
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->youTubeService = $this->mockIocDependency(YouTubeService::class);
|
|
}
|
|
|
|
/**
|
|
* @throws Exception
|
|
*/
|
|
public function testSearchYouTubeVideos()
|
|
{
|
|
$this->createSampleMediaSet();
|
|
$song = Song::first();
|
|
|
|
$this->youTubeService
|
|
->shouldReceive('searchVideosRelatedToSong')
|
|
->once();
|
|
|
|
$this->getAsUser("/api/youtube/search/song/{$song->id}");
|
|
}
|
|
}
|