Merge pull request #94 from Rudloff/analysis-qg5o6Q

Apply fixes from StyleCI
This commit is contained in:
Pierre Rudloff 2017-01-16 17:36:05 +01:00 committed by GitHub
commit 8baa8ae9ff
3 changed files with 65 additions and 37 deletions

View file

@ -98,6 +98,7 @@ class FrontController
'canonical' => $this->getCanonicalUrl($request), 'canonical' => $this->getCanonicalUrl($request),
] ]
); );
return $response; return $response;
} }
@ -123,6 +124,7 @@ class FrontController
'canonical' => $this->getCanonicalUrl($request), 'canonical' => $this->getCanonicalUrl($request),
] ]
); );
return $response; return $response;
} }
@ -146,15 +148,18 @@ class FrontController
'canonical' => $this->getCanonicalUrl($request), 'canonical' => $this->getCanonicalUrl($request),
] ]
); );
return $response; return $response;
} }
/** /**
* Return the converted MP3 file * Return the converted MP3 file.
* @param Request $request PSR-7 request *
* @param Response $response PSR-7 response * @param Request $request PSR-7 request
* @param array $params GET query parameters * @param Response $response PSR-7 response
* @param string $password Video password * @param array $params GET query parameters
* @param string $password Video password
*
* @return Response * @return Response
*/ */
private function getAudioResponse(Request $request, Response $response, array $params, $password = null) private function getAudioResponse(Request $request, Response $response, array $params, $password = null)
@ -187,11 +192,13 @@ class FrontController
} }
/** /**
* Return the video description page * Return the video description page.
* @param Request $request PSR-7 request *
* @param Response $response PSR-7 response * @param Request $request PSR-7 request
* @param array $params GET query parameters * @param Response $response PSR-7 response
* @param string $password Video password * @param array $params GET query parameters
* @param string $password Video password
*
* @return Response * @return Response
*/ */
private function getVideoResponse(Request $request, Response $response, array $params, $password = null) private function getVideoResponse(Request $request, Response $response, array $params, $password = null)
@ -219,6 +226,7 @@ class FrontController
'canonical' => $this->getCanonicalUrl($request), 'canonical' => $this->getCanonicalUrl($request),
] ]
); );
return $response; return $response;
} }
@ -354,10 +362,11 @@ class FrontController
} }
} }
/** /**
* Generate the canonical URL of the current page * Generate the canonical URL of the current page.
* @param Request $request PSR-7 Request *
* @param Request $request PSR-7 Request
*
* @return string URL * @return string URL
*/ */
private function getCanonicalUrl(Request $request) private function getCanonicalUrl(Request $request)

View file

@ -5,8 +5,8 @@
namespace Alltube\Test; namespace Alltube\Test;
use Alltube\Controller\FrontController;
use Alltube\Config; use Alltube\Config;
use Alltube\Controller\FrontController;
use Slim\Container; use Slim\Container;
use Slim\Http\Environment; use Slim\Http\Environment;
use Slim\Http\Request; use Slim\Http\Request;
@ -56,7 +56,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the constructor with streams enabled * Test the constructor with streams enabled.
*
* @return void * @return void
*/ */
public function testConstructorWithStream() public function testConstructorWithStream()
@ -68,7 +69,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the index() function * Test the index() function.
*
* @return void * @return void
*/ */
public function testIndex() public function testIndex()
@ -78,7 +80,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the index() function with a custom URI * Test the index() function with a custom URI.
*
* @return void * @return void
*/ */
public function testIndexWithCustomUri() public function testIndexWithCustomUri()
@ -93,7 +96,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the extractors() function * Test the extractors() function.
*
* @return void * @return void
*/ */
public function testExtractors() public function testExtractors()
@ -103,7 +107,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the password() function * Test the password() function.
*
* @return void * @return void
*/ */
public function testPassword() public function testPassword()
@ -113,7 +118,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the video() function without the url parameter * Test the video() function without the url parameter.
*
* @return void * @return void
*/ */
public function testVideoWithoutUrl() public function testVideoWithoutUrl()
@ -123,7 +129,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the video() function * Test the video() function.
*
* @return void * @return void
*/ */
public function testVideo() public function testVideo()
@ -136,7 +143,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the video() function with audio conversion * Test the video() function with audio conversion.
*
* @return void * @return void
*/ */
public function testVideoWithAudio() public function testVideoWithAudio()
@ -149,15 +157,16 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the video() function with audio enabled and an URL that doesn't need to be converted * Test the video() function with audio enabled and an URL that doesn't need to be converted.
*
* @return void * @return void
*/ */
public function testVideoWithUnconvertedAudio() public function testVideoWithUnconvertedAudio()
{ {
$result = $this->controller->video( $result = $this->controller->video(
$this->request->withQueryParams( $this->request->withQueryParams(
['url'=>'https://soundcloud.com/verwandlungskuenstler/metamorphosis-by-franz-kafka-1', ['url' => 'https://soundcloud.com/verwandlungskuenstler/metamorphosis-by-franz-kafka-1',
'audio'=>true] 'audio'=> true, ]
), ),
$this->response $this->response
); );
@ -165,7 +174,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the video() function with a password * Test the video() function with a password.
*
* @return void * @return void
*/ */
public function testVideoWithPassword() public function testVideoWithPassword()
@ -179,7 +189,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the video() function with a missing password * Test the video() function with a missing password.
*
* @return void * @return void
*/ */
public function testVideoWithMissingPassword() public function testVideoWithMissingPassword()
@ -197,7 +208,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the video() function with streams enabled * Test the video() function with streams enabled.
*
* @return void * @return void
*/ */
public function testVideoWithStream() public function testVideoWithStream()
@ -217,7 +229,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the error() function * Test the error() function.
*
* @return void * @return void
*/ */
public function testError() public function testError()
@ -227,7 +240,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the redirect() function without the URL parameter * Test the redirect() function without the URL parameter.
*
* @return void * @return void
*/ */
public function testRedirectWithoutUrl() public function testRedirectWithoutUrl()
@ -237,7 +251,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the redirect() function * Test the redirect() function.
*
* @return void * @return void
*/ */
public function testRedirect() public function testRedirect()
@ -250,7 +265,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the redirect() function with streams enabled * Test the redirect() function with streams enabled.
*
* @return void * @return void
*/ */
public function testRedirectWithStream() public function testRedirectWithStream()
@ -265,7 +281,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the redirect() function with an M3U stream * Test the redirect() function with an M3U stream.
*
* @return void * @return void
*/ */
public function testRedirectWithM3uStream() public function testRedirectWithM3uStream()
@ -280,7 +297,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the redirect() function with a missing password * Test the redirect() function with a missing password.
*
* @return void * @return void
*/ */
public function testRedirectWithMissingPassword() public function testRedirectWithMissingPassword()
@ -293,7 +311,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* Test the redirect() function with an error * Test the redirect() function with an error.
*
* @return void * @return void
*/ */
public function testRedirectWithError() public function testRedirectWithError()

View file

@ -1,10 +1,10 @@
<?php <?php
/** /**
* File used to bootstrap tests * File used to bootstrap tests.
*/ */
/** /**
* Composer autoload * Composer autoload.
*/ */
require_once __DIR__.'/../vendor/autoload.php'; require_once __DIR__.'/../vendor/autoload.php';