Merged in bugfix/PMC-1345 (pull request #7114)

PMC-1345 Unit test: Circle CI shows an error related with the Importer test.

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Roly
2019-11-01 19:49:33 +00:00
committed by Julio Cesar Laura Avendaño
2 changed files with 12 additions and 6 deletions

View File

@@ -62,13 +62,16 @@ class SkinsTest extends TestCase
*/ */
public function testGetSkinsCurrentWorkspace() public function testGetSkinsCurrentWorkspace()
{ {
$this->object->createSkin('test2', 'test2', 'description skin', config("system.workspace")); $this->object->createSkin('test', 'test');
$skins = $this->object->getSkins(); $this->object->createSkin('test2', 'test2', 'Second skin', 'ProcessMaker Team', 'current', 'neoclassic');
$this->assertCount(3, $skins);
$this->assertEquals('test2', $skins[2]['SKIN_FOLDER_ID']);
$this->object->createSkin('test', 'test', 'description skin', config("system.workspace"));
$skins = $this->object->getSkins(); $skins = $this->object->getSkins();
$skins = collect($skins)
->sortBy('SKIN_FOLDER_ID')
->values()
->toArray();
$this->assertCount(4, $skins); $this->assertCount(4, $skins);
$this->assertEquals('test2', $skins[3]['SKIN_FOLDER_ID']); $this->assertEquals($skins[2]['SKIN_FOLDER_ID'], 'test');
$this->assertEquals($skins[3]['SKIN_FOLDER_ID'], 'test2');
$this->assertEquals($skins[3]['SKIN_WORKSPACE'], config("system.workspace"));
} }
} }

View File

@@ -5,6 +5,7 @@ namespace Tests\unit\workflow\engine\src\ProcessMaker\Importer;
use ProcessMaker\Importer\Importer; use ProcessMaker\Importer\Importer;
use ProcessMaker\Model\BpmnProject; use ProcessMaker\Model\BpmnProject;
use ProcessMaker\Model\Process; use ProcessMaker\Model\Process;
use ProcessMaker\Model\User;
use ReflectionClass; use ReflectionClass;
use Tests\TestCase; use Tests\TestCase;
@@ -292,6 +293,7 @@ define ('DB_REPORT_PASS', '" . env('DB_PASSWORD') . "' );");
// Mock the load method // Mock the load method
$importer->method("load") $importer->method("load")
->willReturn($array); ->willReturn($array);
$importer->setData("usr_uid", factory(User::class)->create()->USR_UID);
// Call the import method // Call the import method
$res = $importer->import(Importer::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW, $res = $importer->import(Importer::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW,
@@ -541,6 +543,7 @@ define ('DB_REPORT_PASS', '" . env('DB_PASSWORD') . "' );");
// Mock the load method // Mock the load method
$importer->method("load") $importer->method("load")
->willReturn($array); ->willReturn($array);
$importer->setData("usr_uid", factory(User::class)->create()->USR_UID);
// Call the setProtectedProperty method // Call the setProtectedProperty method
$this->setProtectedProperty($importer, 'metadata', ['uid' => $process['PRO_UID']]); $this->setProtectedProperty($importer, 'metadata', ['uid' => $process['PRO_UID']]);