HummingBirdAnimeClient/tests/ControllerTest.php

96 lines
2.3 KiB
PHP
Raw Normal View History

2017-01-12 15:41:20 -05:00
<?php declare(strict_types=1);
/**
* Hummingbird Anime List Client
*
* An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
*
* PHP version 7
*
* @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net>
2018-01-15 14:43:15 -05:00
* @copyright 2015 - 2018 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 4.0
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
2017-02-15 11:49:38 -05:00
namespace Aviat\AnimeClient\Tests;
2016-10-20 22:32:17 -04:00
use Aura\Router\RouterFactory;
use Aura\Web\WebFactory;
use Aviat\AnimeClient\Controller;
2017-01-12 15:41:20 -05:00
use Aviat\AnimeClient\Controller\{
Anime as AnimeController,
2017-03-24 09:58:27 -04:00
Character as CharacterController,
AnimeCollection as AnimeCollectionController,
MangaCollection as MangaCollectionController,
2017-01-12 15:41:20 -05:00
Manga as MangaController
};
2017-02-15 16:40:18 -05:00
class ControllerTest extends AnimeClientTestCase {
2017-03-24 09:58:27 -04:00
2017-02-22 15:08:29 -05:00
protected $BaseController;
public function setUp()
{
parent::setUp();
// Create Request/Response Objects
$_SERVER['HTTP_REFERER'] = '';
$this->setSuperGlobals([
'_GET' => [],
'_POST' => [],
'_COOKIE' => [],
'_SERVER' => $_SERVER,
'_FILES' => []
]);
2015-10-15 09:25:30 -04:00
$this->BaseController = new Controller($this->container);
}
2015-10-15 09:25:30 -04:00
public function testControllersSanity()
{
$config = $this->container->get('config');
$config->set(['database', 'collection'], [
'type' => 'sqlite',
'database' => '',
'file' => ":memory:"
]);
$this->container->setInstance('config', $config);
2015-10-15 09:25:30 -04:00
$this->assertInstanceOf(
'Aviat\AnimeClient\Controller',
new AnimeController($this->container)
);
$this->assertInstanceOf(
'Aviat\AnimeClient\Controller',
new MangaController($this->container)
);
2017-03-24 09:58:27 -04:00
$this->assertInstanceOf(
'Aviat\AnimeClient\Controller',
new CharacterController($this->container)
);
2015-10-15 09:25:30 -04:00
$this->assertInstanceOf(
'Aviat\AnimeClient\Controller',
new AnimeCollectionController($this->container)
);
$this->assertInstanceOf(
'Aviat\AnimeClient\Controller',
new MangaCollectionController($this->container)
2015-10-15 09:25:30 -04:00
);
}
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'
);
}
}