PMCORE-3898
This commit is contained in:
35
tests/unit/workflow/engine/classes/WorkspaceToolsTest.php
Normal file → Executable file
35
tests/unit/workflow/engine/classes/WorkspaceToolsTest.php
Normal file → Executable file
@@ -2,10 +2,45 @@
|
|||||||
|
|
||||||
use ProcessMaker\Model\Application;
|
use ProcessMaker\Model\Application;
|
||||||
use ProcessMaker\Model\Delegation;
|
use ProcessMaker\Model\Delegation;
|
||||||
|
use Tests\CreateTestSite;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class WorkspaceToolsTest extends TestCase
|
class WorkspaceToolsTest extends TestCase
|
||||||
{
|
{
|
||||||
|
use CreateTestSite;
|
||||||
|
public $workspace;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call the setUp parent method
|
||||||
|
*/
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp(); // TODO: Change the autogenerated stub
|
||||||
|
|
||||||
|
config(["system.workspace" => "new_site"]);
|
||||||
|
$this->workspace = config("system.workspace");
|
||||||
|
$this->createDBFile($this->workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the updateIsoCountry method
|
||||||
|
*
|
||||||
|
* @covers \WorkspaceTools::updateIsoCountry
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_test_upgrade_Iso_Country_method()
|
||||||
|
{
|
||||||
|
$workspaceTools = new WorkspaceTools($this->workspace);
|
||||||
|
$workspaceTools->updateIsoCountry();
|
||||||
|
|
||||||
|
$result = ob_get_contents();
|
||||||
|
$this->assertRegExp("/-> Update table ISO_COUNTRY Done/", $result);
|
||||||
|
|
||||||
|
$res = IsoCountry::findById('CI');
|
||||||
|
// Assert the result is the expected
|
||||||
|
$this->assertEquals('Côte d\'Ivoire', $res['IC_NAME']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the migrateCaseTitleToThreads method
|
* Tests the migrateCaseTitleToThreads method
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1125,6 +1125,7 @@ class WorkspaceTools
|
|||||||
$this->upgradeSchema($systemSchema, false, false, $includeIndexes);
|
$this->upgradeSchema($systemSchema, false, false, $includeIndexes);
|
||||||
$this->upgradeSchema($systemSchemaRbac, false, true); // Perform upgrade to RBAC
|
$this->upgradeSchema($systemSchemaRbac, false, true); // Perform upgrade to RBAC
|
||||||
$this->upgradeData();
|
$this->upgradeData();
|
||||||
|
$this->updateIsoCountry();
|
||||||
$this->checkRbacPermissions(); //check or add new permissions
|
$this->checkRbacPermissions(); //check or add new permissions
|
||||||
$this->checkSchedulerTable();
|
$this->checkSchedulerTable();
|
||||||
$this->checkSequenceNumber();
|
$this->checkSequenceNumber();
|
||||||
@@ -1445,6 +1446,28 @@ class WorkspaceTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upgrade some IC_NAME values in the table ISO_COUNTRY
|
||||||
|
*/
|
||||||
|
public function updateIsoCountry()
|
||||||
|
{
|
||||||
|
CLI::logging("-> Update table ISO_COUNTRY\n");
|
||||||
|
|
||||||
|
// Initializing
|
||||||
|
$con = Propel::getConnection(IsoCountryPeer::DATABASE_NAME);
|
||||||
|
|
||||||
|
// Update table ISO_COUNTRY
|
||||||
|
$con->begin();
|
||||||
|
$stmt = $con->createStatement();
|
||||||
|
$stmt->executeQuery(""
|
||||||
|
. "UPDATE `ISO_COUNTRY` "
|
||||||
|
. "SET `IC_NAME` = 'Côte d\'Ivoire' "
|
||||||
|
. "WHERE `IC_UID` = 'CI'");
|
||||||
|
$con->commit();
|
||||||
|
|
||||||
|
CLI::logging("-> Update table ISO_COUNTRY Done\n");
|
||||||
|
}
|
||||||
|
|
||||||
public function updateThisRegistry($data)
|
public function updateThisRegistry($data)
|
||||||
{
|
{
|
||||||
$dataBase = $this->getDatabase();
|
$dataBase = $this->getDatabase();
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ INSERT INTO ISO_COUNTRY (IC_UID,IC_NAME,IC_SORT_ORDER) VALUES
|
|||||||
('CF', 'Central African Republic',' ') ,
|
('CF', 'Central African Republic',' ') ,
|
||||||
('CG', 'Congo',' ') ,
|
('CG', 'Congo',' ') ,
|
||||||
('CH', 'Switzerland',' ') ,
|
('CH', 'Switzerland',' ') ,
|
||||||
('CI', 'Cote-d'' lvoire',' ') ,
|
('CI', 'Côte d''Ivoire',' ') ,
|
||||||
('CK', 'Cook Islands',' ') ,
|
('CK', 'Cook Islands',' ') ,
|
||||||
('CL', 'Chile',' ') ,
|
('CL', 'Chile',' ') ,
|
||||||
('CM', 'Cameroon',' ') ,
|
('CM', 'Cameroon',' ') ,
|
||||||
|
|||||||
Reference in New Issue
Block a user