PMCORE-3400

This commit is contained in:
Paula Quispe
2021-10-05 15:51:43 -04:00
parent 8b283d79d7
commit 3aa0a1a583
7 changed files with 51 additions and 27 deletions

View File

@@ -56,6 +56,7 @@ $factory->state(\ProcessMaker\Model\Application::class, 'foreign_keys', function
'APP_PROC_CODE' => '',
'APP_PARALLEL' => 'N',
'APP_INIT_USER' => $user->USR_UID,
'APP_INIT_USER_ID' => $user->USR_ID,
'APP_CUR_USER' => $user->USR_UID,
'APP_PIN' => G::generateUniqueID(),
'APP_CREATE_DATE' => $faker->dateTime(),
@@ -84,10 +85,14 @@ $factory->state(\ProcessMaker\Model\Application::class, 'todo', function (Faker
});
$factory->state(\ProcessMaker\Model\Application::class, 'draft', function (Faker $faker) {
$user = factory(\ProcessMaker\Model\User::class)->create();
return [
'APP_NUMBER' => $faker->unique()->numberBetween(1000),
'APP_STATUS_ID' => 1,
'APP_STATUS' => 'DRAFT'
'APP_STATUS' => 'DRAFT',
'APP_INIT_USER' => $user->USR_UID,
'APP_INIT_USER_ID' => $user->USR_ID,
];
});

View File

@@ -143,6 +143,22 @@ class AbstractCasesTest extends TestCase
$this->assertEquals($users->USR_ID, $actual);
}
/**
* This check the getter and setter related to the user sender
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setSendBy()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getSendBy()
* @test
*/
public function it_return_set_get_user_send()
{
$users = factory(User::class)->create();
$absCases = new AbstractCases();
$absCases->setSendBy($users->USR_UID);
$actual = $absCases->getSendBy();
$this->assertEquals($users->USR_UID, $actual);
}
/**
* This check the getter and setter related to the priority
*

View File

@@ -40,12 +40,11 @@ class DraftTest extends TestCase
public function createDraft()
{
$application = factory(Application::class)->states('draft')->create();
$usrId = User::getId($application['APP_INIT_USER']);
$delegation = factory(Delegation::class)->states('foreign_keys')->create([
'DEL_THREAD_STATUS' => 'OPEN',
'DEL_INDEX' => 1,
'USR_UID' => $application->APP_INIT_USER,
'USR_ID' => $usrId,
'USR_ID' => $application->APP_INIT_USER_ID,
'APP_UID' => $application->APP_UID,
'APP_NUMBER' => $application->APP_NUMBER,
]);
@@ -66,6 +65,7 @@ class DraftTest extends TestCase
for ($i = 0; $i < $cases; $i = $i + 1) {
$application = factory(Application::class)->states('draft')->create([
'APP_INIT_USER' => $user->USR_UID,
'APP_INIT_USER_ID' => $user->USR_ID,
'APP_CUR_USER' => $user->USR_UID,
]);
factory(Delegation::class)->states('foreign_keys')->create([
@@ -73,7 +73,8 @@ class DraftTest extends TestCase
'DEL_INDEX' => 1,
'APP_UID' => $application->APP_UID,
'APP_NUMBER' => $application->APP_NUMBER,
'USR_ID' => $user->USR_ID
'USR_UID' => $application->APP_INIT_USER,
'USR_ID' => $application->APP_INIT_USER_ID,
]);
}

View File

@@ -104,7 +104,7 @@ class ApplicationTest extends TestCase
public function it_return_scope_creator()
{
$table = factory(Application::class)->states('foreign_keys')->create();
$this->assertCount(1, $table->creator($table->APP_INIT_USER)->get());
$this->assertCount(1, $table->creator($table->APP_INIT_USER_ID)->get());
}
/**

View File

@@ -1090,7 +1090,9 @@ class Derivation
// Load Case Data again because the information could be change in method "doDerivation"
$lastData = $this->case->loadCase($appUid);
// Update the thread title related to the last index created
if (!is_null($iNewDelIndex)) {
$this->case->updateThreadTitle($appUid, $lastData['APP_NUMBER'], $iNewDelIndex, $lastData['APP_DATA']);
}
$appFields['APP_DATA'] = $lastData['APP_DATA'];
// When the users route the case in the same time
if($iNewDelIndex !== 0) {

View File

@@ -332,6 +332,26 @@ class AbstractCases implements CasesInterface
return $this->userStarted;
}
/**
* Set send by
*
* @param type $sendBy
*/
public function setSendBy(string $sendBy)
{
$this->sendBy = $sendBy;
}
/**
* Get send by.
*
* @return string
*/
public function getSendBy()
{
return $this->sendBy;
}
/**
* Set value to search
*
@@ -752,26 +772,6 @@ class AbstractCases implements CasesInterface
return $this->casesUids;
}
/**
* Set send by.
*
* @param type $sendBy
*/
public function setSendBy(string $sendBy)
{
$this->sendBy = $sendBy;
}
/**
* Get send by.
*
* @return string
*/
public function getSendBy()
{
return $this->sendBy;
}
/**
* Set Cases Numbers
*

View File

@@ -150,7 +150,7 @@ class Draft extends AbstractCases
// Add the initial scope for draft cases
$query->statusId(Application::STATUS_DRAFT);
// Filter the creator
$query->creator($this->getUserUid());
$query->creator($this->getUserId());
// Return the number of rows
return $query->count(['APPLICATION.APP_NUMBER']);
}