2020-06-04 10:38:48 -04:00
|
|
|
<?php
|
2020-06-11 11:49:54 -04:00
|
|
|
|
2020-06-04 10:38:48 -04:00
|
|
|
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
2020-06-11 11:49:54 -04:00
|
|
|
use ProcessMaker\Model\AppNotes;
|
2020-06-04 10:38:48 -04:00
|
|
|
use ProcessMaker\Model\Documents;
|
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class DocumentsTest
|
|
|
|
|
*
|
|
|
|
|
* @coversDefaultClass \ProcessMaker\Model\Documents
|
|
|
|
|
*/
|
|
|
|
|
class DocumentsTest extends TestCase
|
|
|
|
|
{
|
|
|
|
|
use DatabaseTransactions;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Review get app files related to the case notes
|
|
|
|
|
*
|
|
|
|
|
* @test
|
|
|
|
|
*/
|
|
|
|
|
public function it_test_get_case_note_files()
|
|
|
|
|
{
|
|
|
|
|
$appDoc = factory(Documents::class)->states('case_notes')->create();
|
|
|
|
|
$doc = new Documents();
|
|
|
|
|
$res = $doc->getAppFiles($appDoc->APP_UID, Documents::DOC_TYPE_CASE_NOTE);
|
|
|
|
|
$this->assertNotEmpty($res);
|
|
|
|
|
}
|
2020-06-11 11:49:54 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This test verify if exists attachment files.
|
2020-06-13 11:10:26 -04:00
|
|
|
*
|
2020-06-11 11:49:54 -04:00
|
|
|
* @test
|
2020-06-13 11:10:26 -04:00
|
|
|
* @covers \ProcessMaker\Model\Documents::getAttachedFilesFromTheCaseNote()
|
2020-06-11 11:49:54 -04:00
|
|
|
*/
|
|
|
|
|
public function it_should_test_get_attached_files_from_the_casenote()
|
|
|
|
|
{
|
|
|
|
|
$appNote = factory(AppNotes::class)->create();
|
|
|
|
|
$appDocument = factory(Documents::class)->create([
|
|
|
|
|
'DOC_ID' => $appNote->NOTE_ID
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$appUid = $appDocument->APP_UID;
|
|
|
|
|
$result = Documents::getAttachedFilesFromTheCaseNote($appUid);
|
|
|
|
|
|
|
|
|
|
$this->assertNotEmpty($result);
|
|
|
|
|
}
|
2021-12-14 17:37:04 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This test get files
|
|
|
|
|
*
|
|
|
|
|
* @test
|
|
|
|
|
* @covers \ProcessMaker\Model\Documents::getFiles()
|
|
|
|
|
* @covers \ProcessMaker\Model\Documents::scopeDocId()
|
|
|
|
|
*/
|
|
|
|
|
public function it_should_test_get_files()
|
|
|
|
|
{
|
|
|
|
|
$appNote = factory(AppNotes::class)->create();
|
|
|
|
|
$appDocument = factory(Documents::class)->create([
|
|
|
|
|
'DOC_ID' => $appNote->NOTE_ID
|
|
|
|
|
]);
|
|
|
|
|
$result = Documents::getFiles($appDocument->DOC_ID);
|
|
|
|
|
|
|
|
|
|
$this->assertNotEmpty($result);
|
|
|
|
|
}
|
2020-06-04 10:38:48 -04:00
|
|
|
}
|