2019-04-22 21:52:21 +02:00
|
|
|
<?php
|
2019-10-03 21:24:12 +02:00
|
|
|
|
2019-04-22 21:52:21 +02:00
|
|
|
/**
|
|
|
|
* YoutubeStreamTest class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Alltube\Test;
|
|
|
|
|
2020-06-21 01:44:20 +02:00
|
|
|
use Alltube\Exception\ConfigException;
|
2020-10-22 22:39:09 +02:00
|
|
|
use Alltube\Exception\DependencyException;
|
2020-06-21 01:44:20 +02:00
|
|
|
use Alltube\Library\Exception\AlltubeLibraryException;
|
2019-04-22 21:52:21 +02:00
|
|
|
use Alltube\Stream\YoutubeStream;
|
2020-10-22 22:39:09 +02:00
|
|
|
use SmartyException;
|
2019-04-22 21:52:21 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unit tests for the YoutubeStream class.
|
2019-10-26 16:13:08 +02:00
|
|
|
* @requires download
|
2019-04-22 21:52:21 +02:00
|
|
|
*/
|
|
|
|
class YoutubeStreamTest extends StreamTest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Prepare tests.
|
2020-10-22 22:39:09 +02:00
|
|
|
*
|
2020-10-17 22:07:07 +02:00
|
|
|
* @throws AlltubeLibraryException
|
|
|
|
* @throws ConfigException
|
2020-10-22 22:39:09 +02:00
|
|
|
* @throws DependencyException
|
|
|
|
* @throws SmartyException
|
2019-04-22 21:52:21 +02:00
|
|
|
*/
|
2019-11-30 14:08:18 +01:00
|
|
|
protected function setUp(): void
|
2019-04-22 21:52:21 +02:00
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
2020-10-17 22:07:07 +02:00
|
|
|
$video = $this->downloader->getVideo('https://www.youtube.com/watch?v=dQw4w9WgXcQ', '135');
|
2019-04-22 21:52:21 +02:00
|
|
|
|
2020-10-17 22:07:07 +02:00
|
|
|
$this->stream = new YoutubeStream($this->downloader, $video);
|
2019-04-22 21:52:21 +02:00
|
|
|
}
|
2019-04-26 20:43:01 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the getMetadata() function.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testGetMetadataWithKey()
|
|
|
|
{
|
|
|
|
$this->assertNull($this->stream->getMetadata('foo'));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the detach() function.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testDetach()
|
|
|
|
{
|
|
|
|
$this->assertNull($this->stream->detach());
|
|
|
|
}
|
2019-04-22 21:52:21 +02:00
|
|
|
}
|