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:
Szabo Mónika
2025-01-30 09:35:06 +01:00
committed by Johann Hoffmann
parent 37fa899540
commit 664796c69f
13 changed files with 558 additions and 83 deletions
+41
View File
@@ -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 wont hit any controller until we call it)
require_once __DIR__ . '/vendor/autoload.php';
require_once BASEPATH . 'core/CodeIgniter.php';
}