Make tests run on Windows (fixes #137)

Use AppVeyor to run tests
This commit is contained in:
Pierre Rudloff 2017-11-11 13:58:55 +01:00
parent 88ea150d5a
commit 2432a06c1b
9 changed files with 116 additions and 29 deletions

View file

@ -21,12 +21,25 @@ class VideoDownloadTest extends TestCase
*/
private $download;
/**
* Config class instance.
*
* @var Config
*/
private $config;
/**
* Initialize properties used by test.
*/
protected function setUp()
{
$this->download = new VideoDownload(Config::getInstance('config/config_test.yml'));
if (PHP_OS == 'WINNT') {
$configFile = 'config_test_windows.yml';
} else {
$configFile = 'config_test.yml';
}
$this->config = Config::getInstance('config/'.$configFile);
$this->download = new VideoDownload($this->config);
}
/**
@ -45,9 +58,8 @@ class VideoDownloadTest extends TestCase
*/
public function testConstructorWithMissingYoutubedl()
{
new VideoDownload(
new Config(['youtubedl' => 'foo'])
);
$this->config->youtubedl = 'foo';
new VideoDownload($this->config);
}
/**
@ -58,9 +70,8 @@ class VideoDownloadTest extends TestCase
*/
public function testConstructorWithMissingPython()
{
new VideoDownload(
new Config(['python' => 'foo'])
);
$this->config->python = 'foo';
new VideoDownload($this->config);
}
/**
@ -364,7 +375,8 @@ class VideoDownloadTest extends TestCase
*/
public function testGetAudioStreamAvconvError($url, $format)
{
$download = new VideoDownload(new Config(['avconv' => 'foobar']));
$this->config->avconv = 'foobar';
$download = new VideoDownload($this->config);
$download->getAudioStream($url, $format);
}
@ -380,7 +392,8 @@ class VideoDownloadTest extends TestCase
*/
public function testGetAudioStreamRtmpError($url, $format)
{
$download = new VideoDownload(new Config(['rtmpdump' => 'foobar']));
$this->config->rtmpdump = 'foobar';
$download = new VideoDownload($this->config);
$download->getAudioStream($url, $format);
}
@ -477,7 +490,8 @@ class VideoDownloadTest extends TestCase
*/
public function testGetM3uStreamAvconvError($url, $format)
{
$download = new VideoDownload(new Config(['avconv' => 'foobar']));
$this->config->avconv = 'foobar';
$download = new VideoDownload($this->config);
$video = $download->getJSON($url, $format);
$download->getM3uStream($video);
}
@ -486,6 +500,7 @@ class VideoDownloadTest extends TestCase
* Test getPlaylistArchiveStream function without avconv.
*
* @return void
* @requires OS Linux
*/
public function testGetPlaylistArchiveStream()
{