You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.5 KiB
58 lines
1.5 KiB
<?php
|
|
|
|
namespace testing;
|
|
|
|
$v_dir = dirname(__DIR__, 1) . '/vendor/';
|
|
require_once $v_dir . 'autoload.php';
|
|
|
|
class tts_setup {
|
|
|
|
// Hold the class instance.
|
|
private static $instance = null;
|
|
|
|
// The constructor is private
|
|
// to prevent initiation with outer code.
|
|
private function __construct() {
|
|
$this->setup();
|
|
}
|
|
|
|
// The object is created from within the class itself
|
|
// only if the class has no instance.
|
|
public static function get_instance() {
|
|
if (self::$instance == null) {
|
|
self::$instance = new tts_setup();
|
|
}
|
|
|
|
return self::$instance;
|
|
}
|
|
|
|
private static function setup(): void {
|
|
$p_dir = dirname(__DIR__, 1). '/src/';
|
|
require_once $p_dir . 'before_main.php';
|
|
|
|
\bs_tts\site_helper::set_all_projects(['mockup', 'ex', 'live']);
|
|
\bs_tts\site_helper::set_default_project("mockup");
|
|
|
|
\bs_tts\site_helper::init(PROJECT_BASE_DIR, "", "get", true);
|
|
|
|
require_once PROJECT_BASE_DIR . 'main.php';
|
|
}
|
|
|
|
public static function test_route(string $route): void {
|
|
$PHPUNIT_Testing = true;
|
|
\bs_tts\site_helper::init(PROJECT_BASE_DIR, $route, "get", $PHPUNIT_Testing);
|
|
}
|
|
|
|
public static function do_routes() {
|
|
$returned_route = \tts\router::execute();
|
|
|
|
if ($returned_route["found"] === true) {
|
|
$condition = $returned_route["returned"];
|
|
} else {
|
|
$app = new \tts\app();
|
|
$condition = $app->load_controller();
|
|
}
|
|
return $condition;
|
|
}
|
|
|
|
}
|
|
|