More PHPStan fixes

This commit is contained in:
Timothy Warren 2017-02-22 15:08:29 -05:00
parent adc331d60d
commit 14e8fa9f03
18 changed files with 57 additions and 38 deletions

View File

@ -28,25 +28,14 @@ if ($timezone === '' || $timezone === FALSE)
ini_set('date.timezone', 'GMT');
}
/**
* Joins paths together. Variadic to take an
* arbitrary number of arguments
*
* @return string
*/
function _dir()
{
return implode(DIRECTORY_SEPARATOR, func_get_args());
}
// Load composer autoloader
require __DIR__ . '/vendor/autoload.php';
// Define base directories
$APP_DIR = _dir(__DIR__, 'app');
$APPCONF_DIR = _dir($APP_DIR, 'appConf');
$CONF_DIR = _dir($APP_DIR, 'config');
// Load composer autoloader
require _dir(__DIR__, 'vendor/autoload.php');
// -------------------------------------------------------------------------
// Setup error handling
// -------------------------------------------------------------------------

View File

@ -40,7 +40,7 @@ class MenuGenerator extends UrlGenerator {
/**
* Request object
*
* @var \Aura\Web\Request
* @var \Psr\Http\Message\RequestInterface
*/
protected $request;

View File

@ -24,6 +24,8 @@ use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
class APIRequestBuilderTest extends TestCase {
protected $builder;
public function setUp()
{

View File

@ -23,6 +23,11 @@ use Aviat\Ion\Json;
class AnimeListTransformerTest extends AnimeClientTestCase {
protected $dir;
protected $beforeTransform;
protected $afterTransform;
protected $transformer;
public function setUp()
{
parent::setUp();

View File

@ -23,6 +23,11 @@ use Aviat\Ion\Json;
class AnimeTransformerTest extends AnimeClientTestCase {
protected $dir;
protected $beforeTransform;
protected $afterTransform;
protected $transformer;
public function setUp()
{
parent::setUp();

View File

@ -22,6 +22,12 @@ use Aviat\AnimeClient\Tests\AnimeClientTestCase;
use Aviat\Ion\Json;
class MangaListTransformerTest extends AnimeClientTestCase {
protected $dir;
protected $rawBefore;
protected $beforeTransform;
protected $afterTransform;
protected $transformer;
public function setUp()
{

View File

@ -22,6 +22,11 @@ use Aviat\AnimeClient\Tests\AnimeClientTestCase;
use Aviat\Ion\Json;
class MangaTransformerTest extends AnimeClientTestCase {
protected $dir;
protected $beforeTransform;
protected $afterTransform;
protected $transformer;
public function setUp()
{

View File

@ -6,7 +6,7 @@ use Aviat\AnimeClient\API\{APIRequestBuilder, ParallelAPIRequest};
use Aviat\Ion\Friend;
use PHPUnit\Framework\TestCase;
class ParallelAPIRequestsTest extends TestCase {
class ParallelAPIRequestTest extends TestCase {
public function testAddStringUrlRequest()
{

View File

@ -20,6 +20,12 @@ use Aviat\AnimeClient\API\XML;
use PHPUnit\Framework\TestCase;
class XMLTest extends TestCase {
protected $malExport;
protected $xml;
protected $expectedXml;
protected $object;
protected $array;
public function setUp()
{

View File

@ -16,12 +16,14 @@
namespace Aviat\AnimeClient\Tests;
use function Aviat\AnimeClient\_dir;
class AnimeClientTest extends AnimeClientTestCase {
/**
* Basic sanity test for _dir function
*/
public function testDir()
{
$this->assertEquals('foo' . \DIRECTORY_SEPARATOR . 'bar', \_dir('foo', 'bar'));
$this->assertEquals('foo' . \DIRECTORY_SEPARATOR . 'bar', _dir('foo', 'bar'));
}
}

View File

@ -18,8 +18,9 @@ namespace Aviat\AnimeClient\Tests;
use const Aviat\AnimeClient\SRC_DIR;
use function Aviat\AnimeClient\_dir;
use Aura\Web\WebFactory;
use Aviat\AnimeClient\AnimeClient;
use Aviat\Ion\Json;
use PHPUnit\Framework\TestCase;
use Zend\Diactoros\{

View File

@ -22,6 +22,9 @@ use Aviat\Ion\Friend;
use ConsoleKit\Console;
class BaseCommandTest extends AnimeClientTestCase {
protected $base;
protected $friend;
public function setUp()
{
$this->base = new BaseCommand(new Console());

View File

@ -26,6 +26,8 @@ use Aviat\AnimeClient\Controller\{
};
class ControllerTest extends AnimeClientTestCase {
protected $BaseController;
public function setUp()
{

View File

@ -28,6 +28,7 @@ class DispatcherTest extends AnimeClientTestCase {
protected $container;
protected $router;
protected $config;
protected $urlGenerator;
protected function doSetUp($config, $uri, $host)
{

View File

@ -14,11 +14,15 @@
* @link https://github.com/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Tests;
namespace Aviat\AnimeClient\Tests\Helper;
use Aviat\AnimeClient\Helper\Menu as MenuHelper;
use Aviat\AnimeClient\Tests\AnimeClientTestCase;
class MenuHelperTest extends AnimeClientTestCase {
protected $helper;
protected $urlGenerator;
public function setUp()
{

View File

@ -19,6 +19,8 @@ namespace Aviat\AnimeClient\Tests;
use Aviat\AnimeClient\RoutingBase;
class RoutingBaseTest extends AnimeClientTestCase {
protected $routingBase;
public function setUp()
{

View File

@ -19,6 +19,8 @@ namespace Aviat\AnimeClient\Tests;
use Aviat\AnimeClient\Util;
class UtilTest extends AnimeClientTestCase {
protected $util;
public function setUp()
{

View File

@ -10,28 +10,12 @@ if ($timezone === '' || $timezone === FALSE)
ini_set('date.timezone', 'GMT');
}
// -----------------------------------------------------------------------------
// Global functions
// -----------------------------------------------------------------------------
/**
* Joins paths together. Variadic to take an
* arbitrary number of arguments
*
* @return string
*/
function _dir()
{
return implode(DIRECTORY_SEPARATOR, func_get_args());
}
// -----------------------------------------------------------------------------
// Autoloading
// -----------------------------------------------------------------------------
require _dir(__DIR__, 'AnimeClientTestCase.php');
require _dir(__DIR__, '../vendor/autoload.php');
require __DIR__ . '/AnimeClientTestCase.php';
require __DIR__ . '/../vendor/autoload.php';
// -----------------------------------------------------------------------------
// Ini Settings
@ -51,7 +35,7 @@ $_SESSION = [];
$_COOKIE = [];
// Request base test case and mocks
require _dir(__DIR__, 'TestSessionHandler.php');
require _dir(__DIR__, 'mocks.php');
require __DIR__ . '/TestSessionHandler.php';
require __DIR__ . '/mocks.php';
// End of bootstrap.php