koel/tests/Feature/YouTubeTest.php
2018-08-19 13:13:08 +02:00

40 lines
832 B
PHP

<?php
namespace Tests\Feature;
use App\Models\Song;
use App\Services\YouTubeService;
use Exception;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Mockery\MockInterface;
use YouTube;
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}");
}
}