PMCORE-3880 PhpUnit: Error: Call to undefined function factory

This commit is contained in:
Roly Gutierrez
2022-07-21 00:04:21 -04:00
parent 99fa155266
commit 01833eb210
295 changed files with 6494 additions and 4762 deletions

View File

@@ -6,6 +6,16 @@ use Tests\TestCase;
class WorkspaceToolsTest extends TestCase
{
/**
* Set up method.
* @return void
*/
public function setUp(): void
{
parent::setUp();
$this->truncateNonInitialModels();
}
/**
* Tests the migrateCaseTitleToThreads method
*
@@ -14,63 +24,89 @@ class WorkspaceToolsTest extends TestCase
*/
public function it_should_test_migrate_case_title_to_threads_method()
{
$application1 = factory(Application::class)->create([
$application1 = Application::factory()->create([
'APP_STATUS' => 'TO_DO',
'APP_STATUS_ID' => 2,
]);
$application2 = factory(Application::class)->create([
$application2 = Application::factory()->create([
'APP_STATUS' => 'COMPLETED',
'APP_STATUS_ID' => 3,
]);
$application3 = factory(Application::class)->create([
$application3 = Application::factory()->create([
'APP_STATUS' => 'CANCELED',
'APP_STATUS_ID' => 4,
]);
factory(Delegation::class)->create([
Delegation::factory()->create([
'APP_UID' => $application1->APP_UID,
'APP_NUMBER' => $application1->APP_NUMBER,
'DEL_INDEX' => 1
]);
factory(Delegation::class)->create([
Delegation::factory()->create([
'APP_UID' => $application1->APP_UID,
'APP_NUMBER' => $application1->APP_NUMBER,
'DEL_INDEX' => 2
]);
$delegation1 = factory(Delegation::class)->create([
$delegation1 = Delegation::factory()->create([
'APP_UID' => $application1->APP_UID,
'APP_NUMBER' => $application1->APP_NUMBER,
'DEL_INDEX' => 3,
]);
factory(Delegation::class)->create([
Delegation::factory()->create([
'APP_UID' => $application2->APP_UID,
'APP_NUMBER' => $application2->APP_NUMBER,
'DEL_INDEX' => 1
]);
$delegation2 = factory(Delegation::class)->create([
$delegation2 = Delegation::factory()->create([
'APP_UID' => $application2->APP_UID,
'APP_NUMBER' => $application2->APP_NUMBER,
'DEL_INDEX' => 2,
'DEL_LAST_INDEX' => 1
]);
factory(Delegation::class)->create([
Delegation::factory()->create([
'APP_UID' => $application3->APP_UID,
'APP_NUMBER' => $application3->APP_NUMBER,
'DEL_INDEX' => 1
]);
$delegation3 = factory(Delegation::class)->create([
$delegation3 = Delegation::factory()->create([
'APP_UID' => $application3->APP_UID,
'APP_NUMBER' => $application3->APP_NUMBER,
'DEL_INDEX' => 2,
'DEL_LAST_INDEX' => 1
]);
if (!defined('DB_RBAC_USER')) {
define('DB_RBAC_USER', DB_USER);
}
if (!defined('DB_RBAC_PASS')) {
define('DB_RBAC_PASS', DB_PASS);
}
if (!defined('DB_RBAC_HOST')) {
define('DB_RBAC_HOST', DB_HOST);
}
if (!defined('DB_RBAC_NAME')) {
define('DB_RBAC_NAME', DB_NAME);
}
if (!defined('DB_REPORT_USER')) {
define('DB_REPORT_USER', DB_USER);
}
if (!defined('DB_REPORT_PASS')) {
define('DB_REPORT_PASS', DB_PASS);
}
if (!defined('DB_REPORT_HOST')) {
define('DB_REPORT_HOST', DB_HOST);
}
if (!defined('DB_REPORT_NAME')) {
define('DB_REPORT_NAME', DB_NAME);
}
ob_start();
$workspaceTools = new WorkspaceTools('');
$workspaceTools->migrateCaseTitleToThreads(['testexternal']);
$result = ob_get_contents();
$this->assertRegExp("/The Case Title has been updated successfully in APP_DELEGATION table./", $result);
ob_end_clean();
$this->assertMatchesRegularExpression("/The Case Title has been updated successfully in APP_DELEGATION table./", $result);
$r = Delegation::select('DEL_TITLE')->where('DELEGATION_ID', $delegation1->DELEGATION_ID)->get()->values()->toArray();
$this->assertEquals($r[0]['DEL_TITLE'], $application1->APP_TITLE);