2015-06-25 17:00:29 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Global setup for unit tests
|
|
|
|
*/
|
|
|
|
|
2015-06-26 16:39:10 -04:00
|
|
|
use \AnimeClient\Config;
|
|
|
|
|
2015-06-25 17:00:29 -04:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Mock the default error handler
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class MockErrorHandler {
|
|
|
|
public function addDataTable($name, Array $values) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
$defaultHandler = new MockErrorHandler();
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Define a base testcase class
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base class for TestCases
|
|
|
|
*/
|
2015-06-26 12:03:42 -04:00
|
|
|
class AnimeClient_TestCase extends PHPUnit_Framework_TestCase {
|
|
|
|
|
2015-06-30 13:03:20 -04:00
|
|
|
protected $config;
|
|
|
|
|
2015-06-26 12:03:42 -04:00
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
global $config;
|
2015-06-30 13:03:20 -04:00
|
|
|
$this->config = new Config([
|
2015-06-26 12:03:42 -04:00
|
|
|
'config' => [],
|
|
|
|
'base_config' => [
|
2015-06-30 13:03:20 -04:00
|
|
|
'databaase' => [],
|
|
|
|
'routes' => [
|
|
|
|
'common' => [],
|
|
|
|
'anime' => [],
|
|
|
|
'manga' => []
|
|
|
|
]
|
2015-06-26 12:03:42 -04:00
|
|
|
]
|
|
|
|
]);
|
2015-06-30 13:03:20 -04:00
|
|
|
$config =& $this->config;
|
2015-06-26 12:03:42 -04:00
|
|
|
}
|
|
|
|
}
|
2015-06-25 17:00:29 -04:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// Autoloaders
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2015-06-30 13:03:20 -04:00
|
|
|
// Define WHOSE constant
|
|
|
|
define('WHOSE', "Foo's");
|
|
|
|
|
2015-06-25 17:00:29 -04:00
|
|
|
// Define base path constants
|
2015-06-29 10:26:50 -04:00
|
|
|
define('ROOT_DIR', realpath(__DIR__ . DIRECTORY_SEPARATOR . "/../"));
|
2015-06-25 17:00:29 -04:00
|
|
|
require ROOT_DIR . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . 'pre_conf_functions.php';
|
|
|
|
define('APP_DIR', _dir(ROOT_DIR, 'app'));
|
|
|
|
define('CONF_DIR', _dir(APP_DIR, 'config'));
|
|
|
|
define('BASE_DIR', _dir(APP_DIR, 'base'));
|
|
|
|
|
|
|
|
// Setup autoloaders
|
|
|
|
_setup_autoloaders();
|
2015-06-26 12:03:42 -04:00
|
|
|
require(_dir(BASE_DIR, 'functions.php'));
|
|
|
|
|
|
|
|
// Pre-define some superglobals
|
|
|
|
$_SESSION = [];
|
|
|
|
$_COOKIE = [];
|
2015-06-25 17:00:29 -04:00
|
|
|
|
|
|
|
// End of bootstrap.php
|