style(phpcs): Switch to PSR-12

https://www.php-fig.org/psr/psr-12/
This commit is contained in:
Pierre Rudloff 2019-10-03 21:24:12 +02:00
parent f063f2ead4
commit 44bf858c35
35 changed files with 101 additions and 67 deletions

View File

@ -23,7 +23,7 @@ module.exports = function (grunt) {
}, },
phpcs: { phpcs: {
options: { options: {
standard: 'PSR2', standard: 'PSR12',
bin: 'vendor/bin/phpcs' bin: 'vendor/bin/phpcs'
}, },
php: { php: {

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Config class. * Config class.
*/ */
@ -160,7 +161,7 @@ class Config
} }
} elseif (!$this->stream) { } elseif (!$this->stream) {
// Force HTTP if stream is not enabled. // Force HTTP if stream is not enabled.
$this->replaceGenericFormat($format, $format.'[protocol=https]/'.$format.'[protocol=http]'); $this->replaceGenericFormat($format, $format . '[protocol=https]/' . $format . '[protocol=http]');
} }
} }
} }
@ -197,9 +198,9 @@ class Config
so they will go to the logs. so they will go to the logs.
*/ */
if (!is_file($this->youtubedl)) { if (!is_file($this->youtubedl)) {
throw new Exception("Can't find youtube-dl at ".$this->youtubedl); throw new Exception("Can't find youtube-dl at " . $this->youtubedl);
} elseif (!Video::checkCommand([$this->python, '--version'])) { } elseif (!Video::checkCommand([$this->python, '--version'])) {
throw new Exception("Can't find Python at ".$this->python); throw new Exception("Can't find Python at " . $this->python);
} }
} }
@ -262,7 +263,7 @@ class Config
self::$instance = new self($options); self::$instance = new self($options);
self::$instance->validateOptions(); self::$instance->validateOptions();
} else { } else {
throw new Exception("Can't find config file at ".$file); throw new Exception("Can't find config file at " . $file);
} }
} }

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Locale class. * Locale class.
*/ */
@ -67,7 +68,7 @@ class Locale
*/ */
public function getIso15897() public function getIso15897()
{ {
return $this->language.'_'.$this->region; return $this->language . '_' . $this->region;
} }
/** /**
@ -77,7 +78,7 @@ class Locale
*/ */
public function getBcp47() public function getBcp47()
{ {
return $this->language.'-'.$this->region; return $this->language . '-' . $this->region;
} }
/** /**

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* LocaleManager class. * LocaleManager class.
*/ */
@ -45,7 +46,7 @@ class LocaleManager
if (isset($cookieLocale)) { if (isset($cookieLocale)) {
$this->setLocale(new Locale($cookieLocale)); $this->setLocale(new Locale($cookieLocale));
} }
bindtextdomain('Alltube', __DIR__.'/../i18n/'); bindtextdomain('Alltube', __DIR__ . '/../i18n/');
textdomain('Alltube'); textdomain('Alltube');
} }
@ -61,8 +62,9 @@ class LocaleManager
$process->run(); $process->run();
$installedLocales = explode(PHP_EOL, trim($process->getOutput())); $installedLocales = explode(PHP_EOL, trim($process->getOutput()));
foreach ($this->supportedLocales as $supportedLocale) { foreach ($this->supportedLocales as $supportedLocale) {
if (in_array($supportedLocale, $installedLocales) if (
|| in_array($supportedLocale.'.utf8', $installedLocales) in_array($supportedLocale, $installedLocales)
|| in_array($supportedLocale . '.utf8', $installedLocales)
) { ) {
$return[] = new Locale($supportedLocale); $return[] = new Locale($supportedLocale);
} }
@ -88,8 +90,8 @@ class LocaleManager
*/ */
public function setLocale(Locale $locale) public function setLocale(Locale $locale)
{ {
putenv('LANG='.$locale); putenv('LANG=' . $locale);
setlocale(LC_ALL, [$locale.'.utf8', $locale]); setlocale(LC_ALL, [$locale . '.utf8', $locale]);
$this->curLocale = $locale; $this->curLocale = $locale;
$this->sessionSegment->set('locale', $locale); $this->sessionSegment->set('locale', $locale);
} }

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* LocaleMiddleware class. * LocaleMiddleware class.
*/ */
@ -43,11 +44,12 @@ class LocaleMiddleware
{ {
foreach ($this->localeManager->getSupportedLocales() as $locale) { foreach ($this->localeManager->getSupportedLocales() as $locale) {
$parsedLocale = AcceptLanguage::parse($locale); $parsedLocale = AcceptLanguage::parse($locale);
if (isset($proposedLocale['language']) if (
isset($proposedLocale['language'])
&& $parsedLocale[1]['language'] == $proposedLocale['language'] && $parsedLocale[1]['language'] == $proposedLocale['language']
&& $parsedLocale[1]['region'] == $proposedLocale['region'] && $parsedLocale[1]['region'] == $proposedLocale['region']
) { ) {
return new Locale($proposedLocale['language'].'_'.$proposedLocale['region']); return new Locale($proposedLocale['language'] . '_' . $proposedLocale['region']);
} }
} }
} }

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* SessionManager class. * SessionManager class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* UglyRouter class. * UglyRouter class.
*/ */
@ -55,7 +56,7 @@ class UglyRouter extends Router
$url = str_replace('/', '/?page=', $this->relativePathFor($name, $data, $queryParams)); $url = str_replace('/', '/?page=', $this->relativePathFor($name, $data, $queryParams));
if ($this->basePath) { if ($this->basePath) {
$url = $this->basePath.$url; $url = $this->basePath . $url;
} }
return $url; return $url;

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* VideoDownload class. * VideoDownload class.
*/ */
@ -135,7 +136,7 @@ class Video
$process = self::getProcess($arguments); $process = self::getProcess($arguments);
//This is needed by the openload extractor because it runs PhantomJS //This is needed by the openload extractor because it runs PhantomJS
$process->setEnv(['PATH'=>$config->phantomjsDir]); $process->setEnv(['PATH' => $config->phantomjsDir]);
$process->inheritEnvironmentVariables(); $process->inheritEnvironmentVariables();
$process->run(); $process->run();
if (!$process->isSuccessful()) { if (!$process->isSuccessful()) {
@ -162,7 +163,7 @@ class Video
*/ */
private function getProp($prop = 'dump-json') private function getProp($prop = 'dump-json')
{ {
$arguments = ['--'.$prop]; $arguments = ['--' . $prop];
if (isset($this->webpageUrl)) { if (isset($this->webpageUrl)) {
$arguments[] = $this->webpageUrl; $arguments[] = $this->webpageUrl;
@ -265,7 +266,7 @@ class Video
pathinfo( pathinfo(
$this->getFilename(), $this->getFilename(),
PATHINFO_FILENAME PATHINFO_FILENAME
).'.'.$extension, ) . '.' . $extension,
ENT_COMPAT, ENT_COMPAT,
'ISO-8859-1' 'ISO-8859-1'
); );
@ -281,14 +282,16 @@ class Video
$arguments = []; $arguments = [];
if ($this->protocol == 'rtmp') { if ($this->protocol == 'rtmp') {
foreach ([ foreach (
[
'url' => '-rtmp_tcurl', 'url' => '-rtmp_tcurl',
'webpage_url' => '-rtmp_pageurl', 'webpage_url' => '-rtmp_pageurl',
'player_url' => '-rtmp_swfverify', 'player_url' => '-rtmp_swfverify',
'flash_version' => '-rtmp_flashver', 'flash_version' => '-rtmp_flashver',
'play_path' => '-rtmp_playpath', 'play_path' => '-rtmp_playpath',
'app' => '-rtmp_app', 'app' => '-rtmp_app',
] as $property => $option) { ] as $property => $option
) {
if (isset($this->{$property})) { if (isset($this->{$property})) {
$arguments[] = $option; $arguments[] = $option;
$arguments[] = $this->{$property}; $arguments[] = $this->{$property};
@ -342,7 +345,7 @@ class Video
$to = null $to = null
) { ) {
if (!$this->checkCommand([$this->config->avconv, '-version'])) { if (!$this->checkCommand([$this->config->avconv, '-version'])) {
throw new Exception(_('Can\'t find avconv or ffmpeg at ').$this->config->avconv.'.'); throw new Exception(_('Can\'t find avconv or ffmpeg at ') . $this->config->avconv . '.');
} }
$durationRegex = '/(\d+:)?(\d+:)?(\d+)/'; $durationRegex = '/(\d+:)?(\d+:)?(\d+)/';
@ -355,14 +358,14 @@ class Video
if (!empty($from)) { if (!empty($from)) {
if (!preg_match($durationRegex, $from)) { if (!preg_match($durationRegex, $from)) {
throw new Exception(_('Invalid start time: ').$from.'.'); throw new Exception(_('Invalid start time: ') . $from . '.');
} }
$afterArguments[] = '-ss'; $afterArguments[] = '-ss';
$afterArguments[] = $from; $afterArguments[] = $from;
} }
if (!empty($to)) { if (!empty($to)) {
if (!preg_match($durationRegex, $to)) { if (!preg_match($durationRegex, $to)) {
throw new Exception(_('Invalid end time: ').$to.'.'); throw new Exception(_('Invalid end time: ') . $to . '.');
} }
$afterArguments[] = '-to'; $afterArguments[] = '-to';
$afterArguments[] = $to; $afterArguments[] = $to;
@ -379,7 +382,7 @@ class Video
[ [
'-i', $urls[0], '-i', $urls[0],
'-f', $filetype, '-f', $filetype,
'-b:a', $audioBitrate.'k', '-b:a', $audioBitrate . 'k',
], ],
$afterArguments, $afterArguments,
[ [
@ -441,7 +444,7 @@ class Video
public function getM3uStream() public function getM3uStream()
{ {
if (!$this->checkCommand([$this->config->avconv, '-version'])) { if (!$this->checkCommand([$this->config->avconv, '-version'])) {
throw new Exception(_('Can\'t find avconv or ffmpeg at ').$this->config->avconv.'.'); throw new Exception(_('Can\'t find avconv or ffmpeg at ') . $this->config->avconv . '.');
} }
$urls = $this->getUrl(); $urls = $this->getUrl();

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* ViewFactory class. * ViewFactory class.
*/ */
@ -29,7 +30,7 @@ class ViewFactory
$request = $container['request']; $request = $container['request'];
} }
$view = new Smarty(__DIR__.'/../templates/'); $view = new Smarty(__DIR__ . '/../templates/');
if (in_array('https', $request->getHeader('X-Forwarded-Proto'))) { if (in_array('https', $request->getHeader('X-Forwarded-Proto'))) {
$request = $request->withUri($request->getUri()->withScheme('https')->withPort(443)); $request = $request->withUri($request->getUri()->withScheme('https')->withPort(443));
} }

View File

@ -20,7 +20,7 @@
}, },
"require-dev": { "require-dev": {
"symfony/var-dumper": "~3.4.1", "symfony/var-dumper": "~3.4.1",
"squizlabs/php_codesniffer": "~3.4.0", "squizlabs/php_codesniffer": "^3.5",
"phpunit/phpunit": "~6.5.2", "phpunit/phpunit": "~6.5.2",
"ffmpeg/ffmpeg": "^4.1", "ffmpeg/ffmpeg": "^4.1",
"rg3/youtube-dl": "^2019.09", "rg3/youtube-dl": "^2019.09",

12
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "33493e464172695368aaecf1f8e4e563", "content-hash": "07b922cb69b4f4dbd5e537656d559c8d",
"packages": [ "packages": [
{ {
"name": "aura/session", "name": "aura/session",
@ -3831,16 +3831,16 @@
}, },
{ {
"name": "squizlabs/php_codesniffer", "name": "squizlabs/php_codesniffer",
"version": "3.4.2", "version": "3.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8" "reference": "0afebf16a2e7f1e434920fa976253576151effe9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/0afebf16a2e7f1e434920fa976253576151effe9",
"reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", "reference": "0afebf16a2e7f1e434920fa976253576151effe9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3878,7 +3878,7 @@
"phpcs", "phpcs",
"standards" "standards"
], ],
"time": "2019-04-10T23:49:02+00:00" "time": "2019-09-26T23:12:26+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* BaseController class. * BaseController class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* DownloadController class. * DownloadController class.
*/ */
@ -49,7 +50,8 @@ class DownloadController extends BaseController
return $this->getDownloadResponse($request, $response); return $this->getDownloadResponse($request, $response);
} catch (PasswordException $e) { } catch (PasswordException $e) {
return $response->withRedirect( return $response->withRedirect(
$this->container->get('router')->pathFor('info').'?'.http_build_query($request->getQueryParams()) $this->container->get('router')->pathFor('info') .
'?' . http_build_query($request->getQueryParams())
); );
} catch (Exception $e) { } catch (Exception $e) {
$response->getBody()->write($e->getMessage()); $response->getBody()->write($e->getMessage());
@ -76,8 +78,8 @@ class DownloadController extends BaseController
$response = $response->withHeader( $response = $response->withHeader(
'Content-Disposition', 'Content-Disposition',
'attachment; filename="'. 'attachment; filename="' .
$this->video->getFileNameWithExtension('mp3').'"' $this->video->getFileNameWithExtension('mp3') . '"'
); );
$response = $response->withHeader('Content-Type', 'audio/mpeg'); $response = $response->withHeader('Content-Type', 'audio/mpeg');
@ -153,15 +155,15 @@ class DownloadController extends BaseController
$response = $response->withHeader('Content-Type', 'application/zip'); $response = $response->withHeader('Content-Type', 'application/zip');
$response = $response->withHeader( $response = $response->withHeader(
'Content-Disposition', 'Content-Disposition',
'attachment; filename="'.$this->video->title.'.zip"' 'attachment; filename="' . $this->video->title . '.zip"'
); );
return $response->withBody($stream); return $response->withBody($stream);
} elseif ($this->video->protocol == 'rtmp') { } elseif ($this->video->protocol == 'rtmp') {
$response = $response->withHeader('Content-Type', 'video/'.$this->video->ext); $response = $response->withHeader('Content-Type', 'video/' . $this->video->ext);
$body = new Stream($this->video->getRtmpStream()); $body = new Stream($this->video->getRtmpStream());
} elseif ($this->video->protocol == 'm3u8' || $this->video->protocol == 'm3u8_native') { } elseif ($this->video->protocol == 'm3u8' || $this->video->protocol == 'm3u8_native') {
$response = $response->withHeader('Content-Type', 'video/'.$this->video->ext); $response = $response->withHeader('Content-Type', 'video/' . $this->video->ext);
$body = new Stream($this->video->getM3uStream()); $body = new Stream($this->video->getM3uStream());
} else { } else {
$headers = (array) $this->video->http_headers; $headers = (array) $this->video->http_headers;
@ -192,8 +194,8 @@ class DownloadController extends BaseController
} }
$response = $response->withHeader( $response = $response->withHeader(
'Content-Disposition', 'Content-Disposition',
'attachment; filename="'. 'attachment; filename="' .
$this->video->getFilename().'"' $this->video->getFilename() . '"'
); );
return $response; return $response;
@ -220,7 +222,7 @@ class DownloadController extends BaseController
return $response->withHeader( return $response->withHeader(
'Content-Disposition', 'Content-Disposition',
'attachment; filename="'.$this->video->getFileNameWithExtension('mkv') 'attachment; filename="' . $this->video->getFileNameWithExtension('mkv')
); );
} }
@ -269,10 +271,10 @@ class DownloadController extends BaseController
{ {
$response = $response->withHeader( $response = $response->withHeader(
'Content-Disposition', 'Content-Disposition',
'attachment; filename="'. 'attachment; filename="' .
$this->video->getFileNameWithExtension($request->getQueryParam('customFormat')).'"' $this->video->getFileNameWithExtension($request->getQueryParam('customFormat')) . '"'
); );
$response = $response->withHeader('Content-Type', 'video/'.$request->getQueryParam('customFormat')); $response = $response->withHeader('Content-Type', 'video/' . $request->getQueryParam('customFormat'));
if ($request->isGet() || $request->isPost()) { if ($request->isGet() || $request->isPost()) {
$process = $this->video->getConvertedStream( $process = $this->video->getConvertedStream(

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* FrontController class. * FrontController class.
*/ */
@ -66,7 +67,7 @@ class FrontController extends BaseController
'config' => $this->config, 'config' => $this->config,
'class' => 'index', 'class' => 'index',
'description' => _('Easily download videos from Youtube, Dailymotion, Vimeo and other websites.'), 'description' => _('Easily download videos from Youtube, Dailymotion, Vimeo and other websites.'),
'domain' => $uri->getScheme().'://'.$uri->getAuthority(), 'domain' => $uri->getScheme() . '://' . $uri->getAuthority(),
'canonical' => $this->getCanonicalUrl($request), 'canonical' => $this->getCanonicalUrl($request),
'supportedLocales' => $this->localeManager->getSupportedLocales(), 'supportedLocales' => $this->localeManager->getSupportedLocales(),
'locale' => $this->localeManager->getLocale(), 'locale' => $this->localeManager->getLocale(),
@ -110,7 +111,7 @@ class FrontController extends BaseController
'extractors' => Video::getExtractors(), 'extractors' => Video::getExtractors(),
'class' => 'extractors', 'class' => 'extractors',
'title' => _('Supported websites'), 'title' => _('Supported websites'),
'description' => _('List of all supported websites from which Alltube Download '. 'description' => _('List of all supported websites from which Alltube Download ' .
'can extract video or audio files'), 'can extract video or audio files'),
'canonical' => $this->getCanonicalUrl($request), 'canonical' => $this->getCanonicalUrl($request),
'locale' => $this->localeManager->getLocale(), 'locale' => $this->localeManager->getLocale(),
@ -168,10 +169,11 @@ class FrontController extends BaseController
$template = 'info.tpl'; $template = 'info.tpl';
} }
$title = _('Video download'); $title = _('Video download');
$description = _('Download video from ').$this->video->extractor_key; $description = _('Download video from ') . $this->video->extractor_key;
if (isset($this->video->title)) { if (isset($this->video->title)) {
$title = $this->video->title; $title = $this->video->title;
$description = _('Download').' "'.$this->video->title.'" '._('from').' '.$this->video->extractor_key; $description = _('Download') . ' "' . $this->video->title . '" ' .
_('from') . ' ' . $this->video->extractor_key;
} }
$this->view->render( $this->view->render(
$response, $response,
@ -209,8 +211,8 @@ class FrontController extends BaseController
if ($this->config->convert && $request->getQueryParam('audio')) { if ($this->config->convert && $request->getQueryParam('audio')) {
// We skip the info page and get directly to the download. // We skip the info page and get directly to the download.
return $response->withRedirect( return $response->withRedirect(
$this->container->get('router')->pathFor('download'). $this->container->get('router')->pathFor('download') .
'?'.http_build_query($request->getQueryParams()) '?' . http_build_query($request->getQueryParams())
); );
} else { } else {
return $this->getInfoResponse($request, $response); return $this->getInfoResponse($request, $response);
@ -266,7 +268,7 @@ class FrontController extends BaseController
$query = $uri->getQuery(); $query = $uri->getQuery();
if (!empty($query)) { if (!empty($query)) {
$return .= '?'.$query; $return .= '?' . $query;
} }
return $return; return $return;

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* JsonController class. * JsonController class.
*/ */

View File

@ -1,6 +1,6 @@
<?php <?php
require_once __DIR__.'/vendor/autoload.php'; require_once __DIR__ . '/vendor/autoload.php';
use Alltube\Config; use Alltube\Config;
use Alltube\Controller\DownloadController; use Alltube\Controller\DownloadController;
use Alltube\Controller\FrontController; use Alltube\Controller\FrontController;
@ -12,12 +12,12 @@ use Alltube\ViewFactory;
use Slim\App; use Slim\App;
if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/index.php') !== false) { if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/index.php') !== false) {
header('Location: '.str_ireplace('/index.php', '/', $_SERVER['REQUEST_URI'])); header('Location: ' . str_ireplace('/index.php', '/', $_SERVER['REQUEST_URI']));
die; die;
} }
if (is_file(__DIR__.'/config/config.yml')) { if (is_file(__DIR__ . '/config/config.yml')) {
Config::setFile(__DIR__.'/config/config.yml'); Config::setFile(__DIR__ . '/config/config.yml');
} }
$app = new App(); $app = new App();
@ -82,5 +82,5 @@ $app->get(
try { try {
$app->run(); $app->run();
} catch (SmartyException $e) { } catch (SmartyException $e) {
die('Smarty could not compile the template file: '.$e->getMessage()); die('Smarty could not compile the template file: ' . $e->getMessage());
} }

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* PlaylistArchiveStreamTest class. * PlaylistArchiveStreamTest class.
*/ */
@ -26,7 +27,7 @@ abstract class BaseTest extends TestCase
$configFile = 'config_test.yml'; $configFile = 'config_test.yml';
} }
return __DIR__.'/../config/'.$configFile; return __DIR__ . '/../config/' . $configFile;
} }
/** /**

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* ConfigTest class. * ConfigTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* ControllerTest class. * ControllerTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* ConvertedPlaylistArchiveStreamTest class. * ConvertedPlaylistArchiveStreamTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* DownloadControllerTest class. * DownloadControllerTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* FrontControllerTest class. * FrontControllerTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* JsonControllerTest class. * JsonControllerTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* LocaleManagerTest class. * LocaleManagerTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* LocaleMiddlewareTest class. * LocaleMiddlewareTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* LocaleTest class. * LocaleTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* PlaylistArchiveStreamTest class. * PlaylistArchiveStreamTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* StreamTest class. * StreamTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* UglyRouterTest class. * UglyRouterTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* VideoStubsTest class. * VideoStubsTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* VideoTest class. * VideoTest class.
*/ */
@ -130,7 +131,7 @@ class VideoTest extends BaseTest
], ],
[ [
'https://www.youtube.com/watch?v=RJJ6FCAXvKg', 18, 'https://www.youtube.com/watch?v=RJJ6FCAXvKg', 18,
'Heart_Attack_-_Demi_Lovato_'. 'Heart_Attack_-_Demi_Lovato_' .
'Sam_Tsui_Against_The_Current-RJJ6FCAXvKg', 'Sam_Tsui_Against_The_Current-RJJ6FCAXvKg',
'mp4', 'mp4',
'googlevideo.com', 'googlevideo.com',
@ -289,7 +290,7 @@ class VideoTest extends BaseTest
public function testGetFilename($url, $format, $filename, $extension) public function testGetFilename($url, $format, $filename, $extension)
{ {
$video = new Video($url, $format); $video = new Video($url, $format);
$this->assertEquals($video->getFilename(), $filename.'.'.$extension); $this->assertEquals($video->getFilename(), $filename . '.' . $extension);
} }
/** /**

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* ViewFactoryTest class. * ViewFactoryTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* YoutubeChunkStreamTest class. * YoutubeChunkStreamTest class.
*/ */

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* YoutubeStreamTest class. * YoutubeStreamTest class.
*/ */

View File

@ -1,20 +1,18 @@
<?php <?php
/** /**
* File used to bootstrap tests. * File used to bootstrap tests.
*/ */
use phpmock\mockery\PHPMockery; use phpmock\mockery\PHPMockery;
/** // Composer autoload.
* Composer autoload. require_once __DIR__ . '/../vendor/autoload.php';
*/
require_once __DIR__.'/../vendor/autoload.php';
ini_set('session.use_cookies', 0); ini_set('session.use_cookies', 0);
session_cache_limiter(''); session_cache_limiter('');
session_start(); session_start();
/* // See https://bugs.php.net/bug.php?id=68541
* @see https://bugs.php.net/bug.php?id=68541
*/
PHPMockery::define('Alltube', 'popen'); PHPMockery::define('Alltube', 'popen');
PHPMockery::define('Alltube', 'fopen'); PHPMockery::define('Alltube', 'fopen');