PMC-913 All existing Unit Tests are running correctly?

This commit is contained in:
Roly Rudy Gutierrez Pinto
2019-06-28 14:24:59 -04:00
parent fbcb996b11
commit 6de0b830a9
10 changed files with 166 additions and 84 deletions

View File

@@ -1,13 +1,17 @@
<?php
namespace ProcessMaker\BusinessModel;
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel;
use G;
use ProcessMaker\BusinessModel\WebEntryEvent;
use ProcessMaker\Importer\XmlImporter;
use System;
use Tests\WorkflowTestCase;
/**
* WebEntryEventTest test
*/
class WebEntryEventTest extends \WorkflowTestCase
class WebEntryEventTest extends WorkflowTestCase
{
const SKIP_VALUE = '&SKIP_VALUE%';
@@ -26,20 +30,19 @@ class WebEntryEventTest extends \WorkflowTestCase
*/
protected function setUp()
{
//to do: This is excluded because requires more changes
$this->markTestIncomplete();
$this->getBaseUri();
$this->setupDB();
$this->processUid = $this->import(__DIR__.'/WebEntryEventTest.pmx');
$this->processUid2 = $this->import(__DIR__.'/WebEntryEventTest2.pmx');
$this->object = new WebEntryEvent;
$this->setTranslation('ID_INVALID_VALUE_CAN_NOT_BE_EMPTY',
'ID_INVALID_VALUE_CAN_NOT_BE_EMPTY({0})');
$this->setTranslation('ID_UNDEFINED_VALUE_IS_REQUIRED',
'ID_UNDEFINED_VALUE_IS_REQUIRED({0})');
$this->setTranslation('ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST',
'ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST({0})');
$this->setTranslation('ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES',
'ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES({0},{1})');
$this->setTranslation('ID_DYNAFORM_IS_NOT_ASSIGNED_TO_ACTIVITY',
'ID_DYNAFORM_IS_NOT_ASSIGNED_TO_ACTIVITY({0},{1})');
$this->processUid = $this->import(__DIR__ . '/WebEntryEventTest.pmx');
$this->processUid2 = $this->import(__DIR__ . '/WebEntryEventTest2.pmx');
$this->object = new WebEntryEvent();
$this->setTranslation('ID_INVALID_VALUE_CAN_NOT_BE_EMPTY', 'ID_INVALID_VALUE_CAN_NOT_BE_EMPTY({0})');
$this->setTranslation('ID_UNDEFINED_VALUE_IS_REQUIRED', 'ID_UNDEFINED_VALUE_IS_REQUIRED({0})');
$this->setTranslation('ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST', 'ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST({0})');
$this->setTranslation('ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES', 'ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES({0},{1})');
$this->setTranslation('ID_DYNAFORM_IS_NOT_ASSIGNED_TO_ACTIVITY', 'ID_DYNAFORM_IS_NOT_ASSIGNED_TO_ACTIVITY({0},{1})');
}
/**
@@ -47,10 +50,34 @@ class WebEntryEventTest extends \WorkflowTestCase
*/
protected function tearDown()
{
$this->dropDB();
$this->clearTranslations();
}
/**
* Get base uri for rest applications.
* @return string
*/
private function getBaseUri()
{
$_SERVER = $this->getServerInformation();
$baseUri = System::getServerProtocolHost();
return $baseUri;
}
/**
* Get server information.
* @return object
*/
private function getServerInformation()
{
$pathData = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . ".server_info";
$content = file_get_contents($pathData);
$serverInfo = unserialize($content);
return $serverInfo;
}
/**
* @covers ProcessMaker\BusinessModel\WebEntryEvent::getWebEntryEvents
* @category HOR-3207:5