HummingBirdAnimeClient/tests/bootstrap.php

43 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2020-03-12 09:52:45 -04:00
<?php declare(strict_types=1);
/**
* Global setup for unit tests
*/
// Work around the silly timezone error
2021-02-23 13:10:26 -05:00
date_default_timezone_set('UTC');
2020-03-12 09:52:45 -04:00
2021-02-03 10:27:04 -05:00
define('AC_TEST_ROOT_DIR', dirname(__DIR__) . '/');
define('SRC_DIR', AC_TEST_ROOT_DIR . 'src/');
2021-02-03 09:45:18 -05:00
define('TEST_DIR', __DIR__ . '/');
2020-03-12 09:52:45 -04:00
// -----------------------------------------------------------------------------
// Autoloading
// -----------------------------------------------------------------------------
2021-02-03 09:45:18 -05:00
require_once TEST_DIR . 'AnimeClient/AnimeClientTestCase.php';
require_once TEST_DIR . '/Ion/IonTestCase.php';
2021-02-03 10:27:04 -05:00
require_once AC_TEST_ROOT_DIR . 'vendor/autoload.php';
2020-03-12 09:52:45 -04:00
// -----------------------------------------------------------------------------
// Ini Settings
// -----------------------------------------------------------------------------
ini_set('session.use_cookies', '0');
ini_set('session.use_only_cookies', '0');
ini_set('session.use_trans_sid', '1');
2021-02-03 09:45:18 -05:00
// Start session here to suppress error about headers not sent
2020-03-12 09:52:45 -04:00
session_start();
// -----------------------------------------------------------------------------
// Load base test case and mocks
// -----------------------------------------------------------------------------
// Pre-define some superglobals
$_SESSION = [];
$_COOKIE = [];
// Request base test case and mocks
2021-02-03 09:45:18 -05:00
require_once TEST_DIR . 'AnimeClient/mocks.php';
require_once TEST_DIR . 'Ion/mocks.php';
2020-03-12 09:52:45 -04:00
2022-03-04 12:19:47 -05:00
// End of bootstrap.php