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

@@ -16,6 +16,16 @@ use Tests\TestCase;
class ActionsByEmailTest extends TestCase
{
/**
*
* @return void
*/
public function setUp(): void
{
parent::setUp();
$this->truncateNonInitialModels();
}
/**
* Test the forwardMail method
*
@@ -25,21 +35,21 @@ class ActionsByEmailTest extends TestCase
public function it_should_test_the_forward_mail_method()
{
//Create the Task factory
factory(Task::class)->create();
Task::factory()->create();
//Create the Process factory
factory(Process::class)->create();
Process::factory()->create();
//Create the Dynaform factory
factory(Dynaform::class)->create();
Dynaform::factory()->create();
//Create the EmailServerModel factory
factory(EmailServerModel::class)->create();
EmailServerModel::factory()->create();
//Create the Application factory
factory(Application::class)->create();
Application::factory()->create();
//Create the Delegation factory
$delegation = factory(Delegation::class)->create();
$delegation = Delegation::factory()->create();
//Create the AbeConfiguration factory
$abeConfiguration = factory(AbeConfiguration::class)->create();
$abeConfiguration = AbeConfiguration::factory()->create();
//Create the AbeConfiguration factory
$abeRequest = factory(AbeRequest::class)->create([
$abeRequest = AbeRequest::factory()->create([
'ABE_UID' => $abeConfiguration->ABE_UID,
'APP_UID' => $delegation->APP_UID,
'DEL_INDEX' => $delegation->DEL_INDEX,
@@ -60,7 +70,7 @@ class ActionsByEmailTest extends TestCase
$res = $abe->forwardMail($arrayData);
//Assert the email was sent successfully
$this->assertContains('**ID_EMAIL_RESENT_TO**: ' . $abeRequest->ABE_REQ_SENT_TO, $res);
$this->assertStringContainsString('**ID_EMAIL_RESENT_TO**: ' . $abeRequest->ABE_REQ_SENT_TO, $res);
}
/**
@@ -72,21 +82,21 @@ class ActionsByEmailTest extends TestCase
public function it_should_test_the_forward_mail_method_when_an_error_occurs()
{
//Create the Task factory
factory(Task::class)->create();
Task::factory()->create();
//Create the Process factory
factory(Process::class)->create();
Process::factory()->create();
//Create the Dynaform factory
factory(Dynaform::class)->create();
Dynaform::factory()->create();
//Create the EmailServerModel factory
factory(EmailServerModel::class)->create();
EmailServerModel::factory()->create();
//Create the Application factory
factory(Application::class)->create();
Application::factory()->create();
//Create the Delegation factory
$delegation = factory(Delegation::class)->create();
$delegation = Delegation::factory()->create();
//Create the AbeConfiguration factory
$abeConfiguration = factory(AbeConfiguration::class)->create();
$abeConfiguration = AbeConfiguration::factory()->create();
//Create the AbeConfiguration factory
$abeRequest = factory(AbeRequest::class)->create([
$abeRequest = AbeRequest::factory()->create([
'ABE_UID' => $abeConfiguration->ABE_UID,
'APP_UID' => $delegation->APP_UID,
'DEL_INDEX' => $delegation->DEL_INDEX,
@@ -107,7 +117,7 @@ class ActionsByEmailTest extends TestCase
$res = $abe->forwardMail($arrayData);
//Assert that an unexpected error occur
$this->assertContains('**ID_UNEXPECTED_ERROR_OCCURRED_PLEASE**', $res);
$this->assertStringContainsString('**ID_UNEXPECTED_ERROR_OCCURRED_PLEASE**', $res);
}
/**
@@ -119,23 +129,23 @@ class ActionsByEmailTest extends TestCase
public function it_should_test_the_forward_mail_method_when_the_email_cannot_be_sent()
{
//Create the Task factory
factory(Task::class)->create();
Task::factory()->create();
//Create the Process factory
factory(Process::class)->create();
Process::factory()->create();
//Create the Dynaform factory
factory(Dynaform::class)->create();
Dynaform::factory()->create();
//Create the EmailServerModel factory
factory(EmailServerModel::class)->create();
EmailServerModel::factory()->create();
//Create the Application factory
factory(Application::class)->create();
Application::factory()->create();
//Create the Delegation factory
$delegation = factory(Delegation::class)->create([
$delegation = Delegation::factory()->create([
'DEL_FINISH_DATE' => '2019-09-27 14:53:06'
]);
//Create the AbeConfiguration factory
$abeConfiguration = factory(AbeConfiguration::class)->create();
$abeConfiguration = AbeConfiguration::factory()->create();
//Create the AbeConfiguration factory
$abeRequest = factory(AbeRequest::class)->create([
$abeRequest = AbeRequest::factory()->create([
'ABE_UID' => $abeConfiguration->ABE_UID,
'APP_UID' => $delegation->APP_UID,
'DEL_INDEX' => $delegation->DEL_INDEX,
@@ -156,7 +166,7 @@ class ActionsByEmailTest extends TestCase
$res = $abe->forwardMail($arrayData);
//Assert the email was not sent
$this->assertContains('**ID_UNABLE_TO_SEND_EMAIL**', $res);
$this->assertStringContainsString('**ID_UNABLE_TO_SEND_EMAIL**', $res);
}
/**
@@ -168,23 +178,23 @@ class ActionsByEmailTest extends TestCase
public function it_should_test_the_forward_mail_method_when_the_req_uid_is_not_set()
{
//Create the Task factory
factory(Task::class)->create();
Task::factory()->create();
//Create the Process factory
factory(Process::class)->create();
Process::factory()->create();
//Create the Dynaform factory
factory(Dynaform::class)->create();
Dynaform::factory()->create();
//Create the EmailServerModel factory
factory(EmailServerModel::class)->create();
EmailServerModel::factory()->create();
//Create the Application factory
factory(Application::class)->create();
Application::factory()->create();
//Create the Delegation factory
$delegation = factory(Delegation::class)->create([
$delegation = Delegation::factory()->create([
'DEL_FINISH_DATE' => '2019-09-27 14:53:06'
]);
//Create the AbeConfiguration factory
$abeConfiguration = factory(AbeConfiguration::class)->create();
$abeConfiguration = AbeConfiguration::factory()->create();
//Create the AbeConfiguration factory
$abeRequest = factory(AbeRequest::class)->create([
$abeRequest = AbeRequest::factory()->create([
'ABE_UID' => $abeConfiguration->ABE_UID,
'APP_UID' => $delegation->APP_UID,
'DEL_INDEX' => $delegation->DEL_INDEX,
@@ -204,7 +214,7 @@ class ActionsByEmailTest extends TestCase
$res = $abe->forwardMail($arrayData);
//Assert the email was not sent
$this->assertContains('**ID_UNEXPECTED_ERROR_OCCURRED_PLEASE**', $res);
$this->assertStringContainsString('**ID_UNEXPECTED_ERROR_OCCURRED_PLEASE**', $res);
}
/**
@@ -216,23 +226,23 @@ class ActionsByEmailTest extends TestCase
public function it_should_test_the_forward_mail_method_with_ssl()
{
//Create the Task factory
factory(Task::class)->create();
Task::factory()->create();
//Create the Process factory
factory(Process::class)->create();
Process::factory()->create();
//Create the Dynaform factory
factory(Dynaform::class)->create();
Dynaform::factory()->create();
//Create the EmailServerModel factory with smtp secure
factory(EmailServerModel::class)->create(
EmailServerModel::factory()->create(
['SMTPSECURE' => 'ssl']
);
//Create the Application factory
factory(Application::class)->create();
Application::factory()->create();
//Create the Delegation factory
$delegation = factory(Delegation::class)->create();
$delegation = Delegation::factory()->create();
//Create the AbeConfiguration factory
$abeConfiguration = factory(AbeConfiguration::class)->create();
$abeConfiguration = AbeConfiguration::factory()->create();
//Create the AbeConfiguration factory
$abeRequest = factory(AbeRequest::class)->create([
$abeRequest = AbeRequest::factory()->create([
'ABE_UID' => $abeConfiguration->ABE_UID,
'APP_UID' => $delegation->APP_UID,
'DEL_INDEX' => $delegation->DEL_INDEX,
@@ -253,7 +263,7 @@ class ActionsByEmailTest extends TestCase
$res = $abe->forwardMail($arrayData);
//Assert the email was sent successfully
$this->assertContains('**ID_EMAIL_RESENT_TO**: ' . $abeRequest->ABE_REQ_SENT_TO, $res);
$this->assertStringContainsString('**ID_EMAIL_RESENT_TO**: ' . $abeRequest->ABE_REQ_SENT_TO, $res);
}
/**
@@ -264,13 +274,11 @@ class ActionsByEmailTest extends TestCase
*/
public function it_should_test_the_load_action_by_email_method()
{
AbeConfiguration::truncate();
AbeRequest::truncate();
$user = factory(User::class)->create();
$application = factory(Application::class)->create([
$user = User::factory()->create();
$application = Application::factory()->create([
'APP_UID' => '123456asse'
]);
$delegation = factory(Delegation::class)->create([
$delegation = Delegation::factory()->create([
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'APP_UID' => $application->APP_UID,
@@ -278,7 +286,7 @@ class ActionsByEmailTest extends TestCase
'DEL_PREVIOUS' => 0,
'DEL_INDEX' => 1
]);
$delegation2 = factory(Delegation::class)->create([
$delegation2 = Delegation::factory()->create([
'USR_UID' => $user->USR_UID,
'USR_ID' => $user->USR_ID,
'APP_UID' => $application->APP_UID,
@@ -286,12 +294,12 @@ class ActionsByEmailTest extends TestCase
'DEL_PREVIOUS' => 1,
'DEL_INDEX' => 2
]);
$abeConfiguration = factory(AbeConfiguration::class)->create([
$abeConfiguration = AbeConfiguration::factory()->create([
'PRO_UID' => $delegation->PRO_UID,
'TAS_UID' => $delegation->TAS_UID,
'ABE_TYPE' => 'LINK',
]);
$abeRequest = factory(AbeRequest::class)->create([
$abeRequest = AbeRequest::factory()->create([
'ABE_UID' => $abeConfiguration->ABE_UID,
'APP_UID' => $delegation2->APP_UID,
'DEL_INDEX' => $delegation2->DEL_INDEX,