HummingBirdAnimeClient/tests/AnimeClient/ControllerTest.php
Timothy J. Warren dee4a2dad5
All checks were successful
timw4mail/HummingBirdAnimeClient/pipeline/head This commit looks good
Fix tests for PHP8...?
2020-12-11 14:26:54 -05:00

95 lines
2.2 KiB
PHP

<?php declare(strict_types=1);
/**
* Hummingbird Anime List Client
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 7.4+
*
* @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Tests;
use Aura\Router\RouterFactory;
use Aura\Web\WebFactory;
use Aviat\AnimeClient\Controller;
use Aviat\AnimeClient\Controller\{
Anime as AnimeController,
Character as CharacterController,
AnimeCollection as AnimeCollectionController,
// MangaCollection as MangaCollectionController,
Manga as MangaController
};
class ControllerTest extends AnimeClientTestCase {
protected $BaseController;
public function setUp(): void {
parent::setUp();
// Create Request/Response Objects
$GLOBALS['_SERVER']['HTTP_REFERER'] = '';
$this->setSuperGlobals([
'_GET' => [],
'_POST' => [],
'_COOKIE' => [],
'_SERVER' => $GLOBALS['_SERVER'],
'_FILES' => []
]);
$this->BaseController = new Controller($this->container);
}
public function testControllersSanity()
{
$config = $this->container->get('config');
$config->set('database', [
'type' => 'sqlite',
'database' => '',
'file' => ":memory:"
]);
$this->container->setInstance('config', $config);
$this->assertInstanceOf(
Controller::class,
new AnimeController($this->container)
);
$this->assertInstanceOf(
Controller::class,
new MangaController($this->container)
);
$this->assertInstanceOf(
Controller::class,
new CharacterController($this->container)
);
$this->assertInstanceOf(
Controller::class,
new AnimeCollectionController($this->container)
);
/* $this->assertInstanceOf(
Controller::class,
new MangaCollectionController($this->container)
); */
}
public function testBaseControllerSanity()
{
$this->assertTrue(\is_object($this->BaseController));
}
public function testFormatTitle()
{
$this->assertEquals(
$this->BaseController->formatTitle('foo', 'bar', 'baz'),
'foo &middot; bar &middot; baz'
);
}
}