fix: expand patient check matching and stabilize tests\n\n- allow hyphens and dots in patient identifiers\n- support email and phone lookups in patient existence checks\n- update OpenAPI docs and feature tests for the new request contract\n- load .env during PHPUnit bootstrap so the test database config is available
This commit is contained in:
parent
c743049ed1
commit
c49743bbf3
@ -17,8 +17,8 @@ class PatientController extends Controller {
|
|||||||
$this->db = \Config\Database::connect();
|
$this->db = \Config\Database::connect();
|
||||||
$this->model = new PatientModel();
|
$this->model = new PatientModel();
|
||||||
$this->rules = [
|
$this->rules = [
|
||||||
'PatientID' => 'required|regex_match[/^[A-Za-z0-9]+$/]|max_length[30]',
|
'PatientID' => 'required|regex_match[/^[A-Za-z0-9.-]+$/]|max_length[30]',
|
||||||
'AlternatePID' => 'permit_empty|regex_match[/^[A-Za-z0-9]+$/]|max_length[30]',
|
'AlternatePID' => 'permit_empty|regex_match[/^[A-Za-z0-9.-]+$/]|max_length[30]',
|
||||||
'Prefix' => 'permit_empty|regex_match[/^[A-Za-z\'\. ]+$/]|max_length[10]',
|
'Prefix' => 'permit_empty|regex_match[/^[A-Za-z\'\. ]+$/]|max_length[10]',
|
||||||
'Sex' => 'required',
|
'Sex' => 'required',
|
||||||
|
|
||||||
@ -157,8 +157,8 @@ class PatientController extends Controller {
|
|||||||
$rules = [];
|
$rules = [];
|
||||||
|
|
||||||
$fieldRules = [
|
$fieldRules = [
|
||||||
'PatientID' => 'permit_empty|regex_match[/^[A-Za-z0-9]+$/]|max_length[30]',
|
'PatientID' => 'permit_empty|regex_match[/^[A-Za-z0-9.-]+$/]|max_length[30]',
|
||||||
'AlternatePID' => 'permit_empty|regex_match[/^[A-Za-z0-9]+$/]|max_length[30]',
|
'AlternatePID' => 'permit_empty|regex_match[/^[A-Za-z0-9.-]+$/]|max_length[30]',
|
||||||
'Prefix' => 'permit_empty|regex_match[/^[A-Za-z\'\. ]+$/]|max_length[10]',
|
'Prefix' => 'permit_empty|regex_match[/^[A-Za-z\'\. ]+$/]|max_length[10]',
|
||||||
'Sex' => 'permit_empty',
|
'Sex' => 'permit_empty',
|
||||||
'NameFirst' => 'required|regex_match[/^[A-Za-z\'\. ]+$/]|min_length[1]|max_length[60]',
|
'NameFirst' => 'required|regex_match[/^[A-Za-z\'\. ]+$/]|min_length[1]|max_length[60]',
|
||||||
@ -255,41 +255,61 @@ class PatientController extends Controller {
|
|||||||
public function patientCheck() {
|
public function patientCheck() {
|
||||||
try {
|
try {
|
||||||
$PatientID = $this->request->getVar('PatientID');
|
$PatientID = $this->request->getVar('PatientID');
|
||||||
|
$EmailAddress = $this->request->getVar('EmailAddress');
|
||||||
$EmailAddress1 = $this->request->getVar('EmailAddress1');
|
$EmailAddress1 = $this->request->getVar('EmailAddress1');
|
||||||
|
$EmailAddress2 = $this->request->getVar('EmailAddress2');
|
||||||
$tableName = '';
|
$Phone = $this->request->getVar('Phone');
|
||||||
$searchName = '';
|
|
||||||
|
|
||||||
if (!empty($PatientID)){
|
if (!empty($PatientID)){
|
||||||
$tableName = 'PatientID';
|
if (!preg_match('/^[A-Za-z0-9.-]+$/', (string) $PatientID)) {
|
||||||
$searchName = $PatientID;
|
|
||||||
} elseif (!empty($EmailAddress1)){
|
|
||||||
$tableName = 'EmailAddress1';
|
|
||||||
$searchName = $EmailAddress1;
|
|
||||||
} else {
|
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => 'error',
|
'status' => 'error',
|
||||||
'message' => 'PatientID or EmailAddress1 parameter is required.',
|
'message' => 'PatientID format is invalid.',
|
||||||
'data' => null
|
'data' => null
|
||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
$patient = $this->db->table('patient')
|
$patient = $this->db->table('patient')
|
||||||
->where($tableName, $searchName)
|
->where('PatientID', $PatientID)
|
||||||
->get()
|
->get()
|
||||||
->getRowArray();
|
->getRowArray();
|
||||||
|
} elseif (!empty($EmailAddress) || !empty($EmailAddress1) || !empty($EmailAddress2)){
|
||||||
|
$searchEmail = $EmailAddress ?: $EmailAddress1 ?: $EmailAddress2;
|
||||||
|
|
||||||
|
$patient = $this->db->table('patient')
|
||||||
|
->groupStart()
|
||||||
|
->where('EmailAddress1', $searchEmail)
|
||||||
|
->orWhere('EmailAddress2', $searchEmail)
|
||||||
|
->groupEnd()
|
||||||
|
->get()
|
||||||
|
->getRowArray();
|
||||||
|
} elseif (!empty($Phone)){
|
||||||
|
$patient = $this->db->table('patient')
|
||||||
|
->groupStart()
|
||||||
|
->where('Phone', $Phone)
|
||||||
|
->orWhere('MobilePhone', $Phone)
|
||||||
|
->groupEnd()
|
||||||
|
->get()
|
||||||
|
->getRowArray();
|
||||||
|
} else {
|
||||||
|
return $this->respond([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'PatientID, EmailAddress, or Phone parameter is required.',
|
||||||
|
'data' => null
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$patient) {
|
if (!$patient) {
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => "$tableName not found.",
|
'message' => !empty($PatientID) ? 'PatientID not found.' : (!empty($Phone) ? 'Phone not found.' : 'EmailAddress not found.'),
|
||||||
'data' => true,
|
'data' => true,
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => "$tableName already exists.",
|
'message' => !empty($PatientID) ? 'PatientID already exists.' : (!empty($Phone) ? 'Phone already exists.' : 'EmailAddress already exists.'),
|
||||||
'data' => false,
|
'data' => false,
|
||||||
], 200);
|
], 200);
|
||||||
|
|
||||||
|
|||||||
@ -54,12 +54,5 @@
|
|||||||
<const name="CONFIGPATH" value="./app/Config/"/>
|
<const name="CONFIGPATH" value="./app/Config/"/>
|
||||||
<!-- Directory containing the front controller (index.php) -->
|
<!-- Directory containing the front controller (index.php) -->
|
||||||
<const name="PUBLICPATH" value="./public/"/>
|
<const name="PUBLICPATH" value="./public/"/>
|
||||||
<!-- Database configuration -->
|
|
||||||
<env name="database.tests.hostname" value="localhost"/> <!-- WAJIB DISESUAIKAN -->
|
|
||||||
<env name="database.tests.database" value="clqms01_test"/> <!-- WAJIB DISESUAIKAN -->
|
|
||||||
<env name="database.tests.username" value="root"/> <!-- WAJIB DISESUAIKAN -->
|
|
||||||
<env name="database.tests.password" value="databaseadminsakti"/> <!-- WAJIB DISESUAIKAN -->
|
|
||||||
<env name="database.tests.DBDriver" value="MySQLi"/> <!-- WAJIB DISESUAIKAN -->
|
|
||||||
<!-- <env name="database.tests.DBPrefix" value="tests_"/> -->
|
|
||||||
</php>
|
</php>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|||||||
@ -2931,12 +2931,29 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
description: Patient ID to check
|
description: Patient ID to check
|
||||||
- name: EmailAddress1
|
- name: EmailAddress
|
||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
format: email
|
format: email
|
||||||
description: Email address to check
|
description: Email address to check
|
||||||
|
- name: EmailAddress1
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: email
|
||||||
|
description: Email address alias to check
|
||||||
|
- name: EmailAddress2
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: email
|
||||||
|
description: Email address alias to check
|
||||||
|
- name: Phone
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Phone number to check
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Patient check result
|
description: Patient check result
|
||||||
|
|||||||
@ -103,12 +103,29 @@
|
|||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
description: Patient ID to check
|
description: Patient ID to check
|
||||||
- name: EmailAddress1
|
- name: EmailAddress
|
||||||
in: query
|
in: query
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
format: email
|
format: email
|
||||||
description: Email address to check
|
description: Email address to check
|
||||||
|
- name: EmailAddress1
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: email
|
||||||
|
description: Email address alias to check
|
||||||
|
- name: EmailAddress2
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: email
|
||||||
|
description: Email address alias to check
|
||||||
|
- name: Phone
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Phone number to check
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Patient check result
|
description: Patient check result
|
||||||
|
|||||||
@ -2,212 +2,118 @@
|
|||||||
|
|
||||||
namespace Tests\Feature\Patients;
|
namespace Tests\Feature\Patients;
|
||||||
|
|
||||||
use CodeIgniter\Test\FeatureTestTrait;
|
|
||||||
use CodeIgniter\Test\CIUnitTestCase;
|
use CodeIgniter\Test\CIUnitTestCase;
|
||||||
|
use CodeIgniter\Test\FeatureTestTrait;
|
||||||
use Faker\Factory;
|
use Faker\Factory;
|
||||||
|
|
||||||
/**
|
|
||||||
* PatientCheckTest
|
|
||||||
*
|
|
||||||
* Test cases for Patient Check endpoint
|
|
||||||
* Endpoint: GET api/patient/check
|
|
||||||
*
|
|
||||||
* This endpoint checks if a PatientID or EmailAddress1 already exists in the database.
|
|
||||||
* Returns data: true if NOT found (available), false if found (already exists)
|
|
||||||
*
|
|
||||||
* Test Cases:
|
|
||||||
* 1. testCheckPatientIDExists - Check existing PatientID
|
|
||||||
* 2. testCheckPatientIDNotExists - Check non-existing PatientID
|
|
||||||
* 3. testCheckEmailExists - Check existing Email
|
|
||||||
* 4. testCheckEmailNotExists - Check non-existing Email
|
|
||||||
* 5. testCheckWithoutParams - Check without any parameters
|
|
||||||
* 6. testCheckWithBothParams - Check with both parameters (PatientID takes priority)
|
|
||||||
*/
|
|
||||||
class PatientCheckTest extends CIUnitTestCase
|
class PatientCheckTest extends CIUnitTestCase
|
||||||
{
|
{
|
||||||
use FeatureTestTrait;
|
use FeatureTestTrait;
|
||||||
|
|
||||||
protected $endpoint = 'api/patient/check';
|
protected $endpoint = 'api/patient/check';
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test Case 1: Check existing PatientID
|
|
||||||
* Expected: 200 OK with data: false (already exists)
|
|
||||||
*/
|
|
||||||
public function testCheckPatientIDExists()
|
public function testCheckPatientIDExists()
|
||||||
{
|
{
|
||||||
// Assuming SMAJ1 exists in the test database
|
|
||||||
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
||||||
'PatientID' => 'SMAJ1'
|
'PatientID' => 'SMAJ1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$result->assertStatus(200);
|
$result->assertStatus(200);
|
||||||
|
$data = json_decode($result->getJSON(), true);
|
||||||
|
|
||||||
$json = $result->getJSON();
|
$this->assertSame('success', $data['status']);
|
||||||
$data = json_decode($json, true);
|
$this->assertSame(false, $data['data']);
|
||||||
|
}
|
||||||
$this->assertEquals('success', $data['status']);
|
|
||||||
// If patient exists, data should be false (not available)
|
public function testCheckPatientIDWithHyphenExists()
|
||||||
if ($data['data'] === false) {
|
{
|
||||||
$this->assertStringContainsString('already exists', $data['message']);
|
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
||||||
}
|
'PatientID' => 'SMAJ-1',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$result->assertStatus(200);
|
||||||
|
$data = json_decode($result->getJSON(), true);
|
||||||
|
|
||||||
|
$this->assertSame('success', $data['status']);
|
||||||
|
$this->assertIsBool($data['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test Case 2: Check non-existing PatientID
|
|
||||||
* Expected: 200 OK with data: true (available)
|
|
||||||
*/
|
|
||||||
public function testCheckPatientIDNotExists()
|
public function testCheckPatientIDNotExists()
|
||||||
{
|
{
|
||||||
$faker = Factory::create();
|
$faker = Factory::create();
|
||||||
|
|
||||||
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
||||||
'PatientID' => 'NONEXISTENT' . $faker->numberBetween(100000, 999999)
|
'PatientID' => 'NONEXISTENT-' . $faker->numberBetween(100000, 999999),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$result->assertStatus(200);
|
$result->assertStatus(200);
|
||||||
|
$data = json_decode($result->getJSON(), true);
|
||||||
|
|
||||||
$json = $result->getJSON();
|
$this->assertSame('success', $data['status']);
|
||||||
$data = json_decode($json, true);
|
$this->assertTrue($data['data']);
|
||||||
|
|
||||||
$this->assertEquals('success', $data['status']);
|
|
||||||
$this->assertTrue($data['data']); // Available means true
|
|
||||||
$this->assertStringContainsString('not found', $data['message']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function testCheckEmailAddressExists()
|
||||||
* Test Case 3: Check existing Email
|
|
||||||
* Expected: 200 OK with data: false (already exists)
|
|
||||||
*
|
|
||||||
* NOTE: Requires a known email in the database
|
|
||||||
*/
|
|
||||||
public function testCheckEmailFormat()
|
|
||||||
{
|
{
|
||||||
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
||||||
'EmailAddress1' => 'test@example.com'
|
'EmailAddress' => 'dummy1@test.com',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$result->assertStatus(200);
|
$result->assertStatus(200);
|
||||||
|
$data = json_decode($result->getJSON(), true);
|
||||||
|
|
||||||
$json = $result->getJSON();
|
$this->assertSame('success', $data['status']);
|
||||||
$data = json_decode($json, true);
|
|
||||||
|
|
||||||
$this->assertEquals('success', $data['status']);
|
|
||||||
$this->assertIsBool($data['data']);
|
$this->assertIsBool($data['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function testCheckEmailAddressAliasExists()
|
||||||
* Test Case 4: Check non-existing Email
|
|
||||||
* Expected: 200 OK with data: true (available)
|
|
||||||
*/
|
|
||||||
public function testCheckEmailNotExists()
|
|
||||||
{
|
{
|
||||||
$faker = Factory::create();
|
|
||||||
|
|
||||||
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
||||||
'EmailAddress1' => 'nonexistent_' . $faker->numberBetween(100000, 999999) . '@test.com'
|
'EmailAddress1' => 'dummy1@test.com',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$result->assertStatus(200);
|
$result->assertStatus(200);
|
||||||
|
$data = json_decode($result->getJSON(), true);
|
||||||
|
|
||||||
$json = $result->getJSON();
|
$this->assertSame('success', $data['status']);
|
||||||
$data = json_decode($json, true);
|
$this->assertIsBool($data['data']);
|
||||||
|
|
||||||
$this->assertEquals('success', $data['status']);
|
|
||||||
$this->assertTrue($data['data']); // Available means true
|
|
||||||
$this->assertStringContainsString('not found', $data['message']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function testCheckPhoneExists()
|
||||||
* Test Case 5: Check with empty PatientID
|
|
||||||
* Expected: May return 500 or handle gracefully
|
|
||||||
*/
|
|
||||||
public function testCheckWithEmptyPatientID()
|
|
||||||
{
|
{
|
||||||
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
||||||
'PatientID' => ''
|
'Phone' => '092029',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Should either return 200 (graceful handling) or 500 (error)
|
$result->assertStatus(200);
|
||||||
// Workaround for environment wrapping JSON in HTML causing null status code
|
$data = json_decode($result->getJSON(), true);
|
||||||
if ($result->getStatusCode() === null) {
|
|
||||||
$body = strip_tags($result->getBody());
|
$this->assertSame('success', $data['status']);
|
||||||
$data = json_decode($body, true);
|
$this->assertIsBool($data['data']);
|
||||||
$this->assertEquals('error', $data['status'] ?? '');
|
|
||||||
$this->assertEquals('PatientID or EmailAddress1 parameter is required.', $data['message'] ?? '');
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertContains($result->getStatusCode(), [200, 400, 500]);
|
public function testCheckWithoutParams()
|
||||||
|
{
|
||||||
|
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint);
|
||||||
|
|
||||||
|
$result->assertStatus(400);
|
||||||
|
$data = json_decode($result->getJSON(), true);
|
||||||
|
|
||||||
|
$this->assertSame('error', $data['status']);
|
||||||
|
$this->assertSame('PatientID, EmailAddress, or Phone parameter is required.', $data['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test Case 6: Check for response structure
|
|
||||||
* Expected: Response should have status, message, and data keys
|
|
||||||
*/
|
|
||||||
public function testCheckResponseStructure()
|
public function testCheckResponseStructure()
|
||||||
{
|
{
|
||||||
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
||||||
'PatientID' => 'TEST123'
|
'PatientID' => 'TEST123',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$result->assertStatus(200);
|
$result->assertStatus(200);
|
||||||
|
$data = json_decode($result->getJSON(), true);
|
||||||
$json = $result->getJSON();
|
|
||||||
$data = json_decode($json, true);
|
|
||||||
|
|
||||||
$this->assertArrayHasKey('status', $data);
|
$this->assertArrayHasKey('status', $data);
|
||||||
$this->assertArrayHasKey('message', $data);
|
$this->assertArrayHasKey('message', $data);
|
||||||
$this->assertArrayHasKey('data', $data);
|
$this->assertArrayHasKey('data', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test Case 7: Check with special characters in PatientID
|
|
||||||
* Expected: Should handle gracefully
|
|
||||||
*/
|
|
||||||
public function testCheckWithSpecialCharacters()
|
|
||||||
{
|
|
||||||
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
|
||||||
'PatientID' => "TEST'123"
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Should not crash - either 200 or appropriate error
|
|
||||||
// Workaround for environment wrapping
|
|
||||||
if ($result->getStatusCode() === null) {
|
|
||||||
$body = strip_tags($result->getBody());
|
|
||||||
$data = json_decode($body, true);
|
|
||||||
$this->assertEquals('success', $data['status'] ?? '');
|
|
||||||
// message could be 'PatientID not found.' or '... already exists.'
|
|
||||||
$this->assertArrayHasKey('message', $data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$this->assertContains($result->getStatusCode(), [200, 400, 500]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test Case 8: Check with very long PatientID
|
|
||||||
* Expected: Should handle gracefully
|
|
||||||
*/
|
|
||||||
public function testCheckWithVeryLongPatientID()
|
|
||||||
{
|
|
||||||
$longId = str_repeat('A', 100);
|
|
||||||
|
|
||||||
$result = $this->withHeaders(['Accept' => 'application/json'])->call('get', $this->endpoint, [
|
|
||||||
'PatientID' => $longId
|
|
||||||
]);
|
|
||||||
|
|
||||||
$result->assertStatus(200);
|
|
||||||
|
|
||||||
$json = $result->getJSON();
|
|
||||||
$data = json_decode($json, true);
|
|
||||||
|
|
||||||
// Long ID that doesn't exist should return true (available)
|
|
||||||
$this->assertEquals('success', $data['status']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
require_once __DIR__ . '/../vendor/codeigniter4/framework/system/Test/bootstrap.php';
|
require_once __DIR__ . '/../vendor/codeigniter4/framework/system/Test/bootstrap.php';
|
||||||
|
|
||||||
|
use CodeIgniter\Config\DotEnv;
|
||||||
|
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||||
use CodeIgniter\Database\MigrationRunner;
|
use CodeIgniter\Database\MigrationRunner;
|
||||||
use Config\Database;
|
use Config\Database;
|
||||||
use Config\Migrations as MigrationsConfig;
|
use Config\Migrations as MigrationsConfig;
|
||||||
@ -14,6 +16,8 @@ if (defined('CLQMS_PHPUNIT_BOOTSTRAPPED') || ENVIRONMENT !== 'testing') {
|
|||||||
|
|
||||||
define('CLQMS_PHPUNIT_BOOTSTRAPPED', true);
|
define('CLQMS_PHPUNIT_BOOTSTRAPPED', true);
|
||||||
|
|
||||||
|
(new DotEnv(ROOTPATH))->load();
|
||||||
|
|
||||||
$db = Database::connect('tests');
|
$db = Database::connect('tests');
|
||||||
$forge = Database::forge('tests');
|
$forge = Database::forge('tests');
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user