mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-01 19:09:27 +00:00
using phpunit to test controllers which are running in codeigniter3 requires further request/response mocking; setup of swagger-ui and swagger openapi doc generation for bookmark.php; WIP integration tests with ci3 & phpunit, maybe annotation generation solution for swagger annotations
This commit is contained in:
committed by
Johann Hoffmann
parent
37fa899540
commit
664796c69f
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
// tests/Bootstrap.php
|
||||
if (! defined('CI_BOOTSTRAPPED'))
|
||||
{
|
||||
define('CI_BOOTSTRAPPED', true);
|
||||
|
||||
// 1) point these at your project
|
||||
define('ENVIRONMENT', 'testing');
|
||||
$_SERVER['CI_ENV'] = 'testing';
|
||||
|
||||
$system_path = __DIR__ . '/vendor/codeigniter/framework/system';
|
||||
$application_folder = __DIR__ . '/application';
|
||||
$view_folder = '';
|
||||
|
||||
if (($_temp = realpath($system_path)) !== FALSE) {
|
||||
$system_path = $_temp . '/';
|
||||
} else {
|
||||
$system_path = rtrim($system_path, '/') . '/';
|
||||
}
|
||||
|
||||
define('BASEPATH', str_replace("\\", "/", $system_path));
|
||||
define('APPPATH', str_replace("\\", "/", realpath($application_folder)) . '/');
|
||||
if (!empty($view_folder) && is_dir($view_folder)) {
|
||||
$view_folder = realpath($view_folder) . '/';
|
||||
} elseif (is_dir(APPPATH . 'views/')) {
|
||||
$view_folder = APPPATH . 'views/';
|
||||
} else {
|
||||
exit('Your view folder path is invalid');
|
||||
}
|
||||
define('VIEWPATH', $view_folder);
|
||||
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
|
||||
define('FCPATH', __DIR__ . '/');
|
||||
|
||||
// 2) show all errors while testing
|
||||
error_reporting(-1);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
// 3) bring in the core (but we won’t hit any controller until we call it)
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
require_once BASEPATH . 'core/CodeIgniter.php';
|
||||
}
|
||||
Reference in New Issue
Block a user