Fix conflicts with develop branch
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use Exception;
|
||||
use G;
|
||||
use ProcessMaker\Model\Application;
|
||||
use RBAC;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Class DelegationTest
|
||||
*
|
||||
* @coversDefaultClass \ProcessMaker\BusinessModel\Cases
|
||||
*/
|
||||
class CasesTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* This checks the delete case
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::deleteCase()
|
||||
* @test
|
||||
* @expectedException Exception
|
||||
*/
|
||||
public function it_should_not_delete_case_without_permission()
|
||||
{
|
||||
// Set the RBAC
|
||||
global $RBAC;
|
||||
$_SESSION['USER_LOGGED'] = '00000000000000000000000000000002';
|
||||
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
|
||||
$RBAC->initRBAC();
|
||||
|
||||
$application = factory(Application::class)->create();
|
||||
// Tried to delete case
|
||||
$case = new Cases();
|
||||
$case->deleteCase($application->APP_UID, $_SESSION['USER_LOGGED']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks the delete case
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::deleteCase()
|
||||
* @test
|
||||
* @expectedException Exception
|
||||
*/
|
||||
public function it_should_not_delete_case_in_todo_status()
|
||||
{
|
||||
// Set the RBAC
|
||||
global $RBAC;
|
||||
$_SESSION['USER_LOGGED'] = '00000000000000000000000000000001';
|
||||
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
|
||||
$RBAC->initRBAC();
|
||||
|
||||
$application = factory(Application::class)->create(['APP_STATUS' => 'TO_DO']);
|
||||
// Tried to delete case
|
||||
$case = new Cases();
|
||||
$case->deleteCase($application->APP_UID, $_SESSION['USER_LOGGED']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks the delete case
|
||||
*
|
||||
* @covers \ProcessMaker\BusinessModel\Cases::deleteCase()
|
||||
* @test
|
||||
* @expectedException Exception
|
||||
*/
|
||||
public function it_should_not_delete_case_when_is_not_owner()
|
||||
{
|
||||
// Set the RBAC
|
||||
global $RBAC;
|
||||
$_SESSION['USER_LOGGED'] = '00000000000000000000000000000001';
|
||||
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
|
||||
$RBAC->initRBAC();
|
||||
|
||||
$application = factory(Application::class)->create(['APP_INIT_USER' => '00000000000000000000000000000002']);
|
||||
// Tried to delete case
|
||||
$case = new Cases();
|
||||
$case->deleteCase($application->APP_UID, $_SESSION['USER_LOGGED']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel;
|
||||
|
||||
use Faker\Factory;
|
||||
use ProcessMaker\BusinessModel\Light;
|
||||
use Tests\TestCase;
|
||||
|
||||
class LightTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* This verifies that the mobile_offline_tables_download_interval parameter
|
||||
* is defined in the result returned by the getConfiguration() method.
|
||||
*
|
||||
* @test
|
||||
* @covers \ProcessMaker\BusinessModel\Light::getConfiguration
|
||||
*/
|
||||
public function it_should_return_mobile_offline_tables_download_interval_from_get_configuration_method()
|
||||
{
|
||||
$param = [
|
||||
'fileLimit' => true,
|
||||
'tz' => true,
|
||||
];
|
||||
$light = new Light();
|
||||
|
||||
/**
|
||||
* In the getConfiguration() method, the next section:
|
||||
*
|
||||
* $postMaxSize = $this->return_bytes(ini_get('post_max_size'));
|
||||
* $uploadMaxFileSize = $this->return_bytes(ini_get('upload_max_filesize'));
|
||||
* if ($postMaxSize < $uploadMaxFileSize) {
|
||||
* $uploadMaxFileSize = $postMaxSize;
|
||||
* }
|
||||
*
|
||||
* It can only be tested if you change the values of "post_max_size" and "upload_max_filesize"
|
||||
* in php.ini, you can't use the ini_set() function.
|
||||
* The mode change of these directives is "PHP_INI_PERDIR", where is entry can be
|
||||
* set in php.ini, .htaccess, httpd.conf or .user.ini, see here:
|
||||
* https://www.php.net/manual/es/ini.list.php
|
||||
* https://www.php.net/manual/en/configuration.changes.modes.php
|
||||
*/
|
||||
$result = $light->getConfiguration($param);
|
||||
|
||||
$this->assertArrayHasKey('mobile_offline_tables_download_interval', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the value of mobile_offline_tables_download_interval
|
||||
* @test
|
||||
* @covers \ProcessMaker\BusinessModel\Light::getConfiguration
|
||||
*/
|
||||
public function this_should_return_mobile_offline_tables_download_interval_inside_env()
|
||||
{
|
||||
$oldContent = "";
|
||||
$path = PATH_CONFIG . "env.ini";
|
||||
if (file_exists($path)) {
|
||||
$oldContent = file_get_contents($path);
|
||||
}
|
||||
|
||||
$expected = 30;
|
||||
|
||||
$content = "mobile_offline_tables_download_interval = {$expected};";
|
||||
file_put_contents($path, $content);
|
||||
|
||||
$light = new Light();
|
||||
$result = $light->getConfiguration([]);
|
||||
$actual = $result['mobile_offline_tables_download_interval'];
|
||||
|
||||
file_put_contents($path, $oldContent);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the default value of mobile_offline_tables_download_interval.
|
||||
* @test
|
||||
* @covers \ProcessMaker\BusinessModel\Light::getConfiguration
|
||||
*/
|
||||
public function this_should_return_default_value_if_mobile_offline_tables_download_interval_inside_env_is_not_an_integer()
|
||||
{
|
||||
$oldContent = "";
|
||||
$path = PATH_CONFIG . "env.ini";
|
||||
if (file_exists($path)) {
|
||||
$oldContent = file_get_contents($path);
|
||||
}
|
||||
|
||||
$faker = $faker = Factory::create();
|
||||
$alphanumeric = $faker->regexify('[A-Za-z0-9]{20}');
|
||||
$content = "mobile_offline_tables_download_interval = '{$alphanumeric}';";
|
||||
file_put_contents($path, $content);
|
||||
|
||||
$light = new Light();
|
||||
$result = $light->getConfiguration([]);
|
||||
$expected = (string) $result['mobile_offline_tables_download_interval'];
|
||||
|
||||
file_put_contents($path, $oldContent);
|
||||
|
||||
$this->assertTrue(ctype_digit($expected));
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\Core;
|
||||
|
||||
use G;
|
||||
use Faker\Factory;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Model\EmailServerModel;
|
||||
use Tests\TestCase;
|
||||
@@ -24,6 +26,8 @@ class SystemTest extends TestCase
|
||||
*/
|
||||
public function it_should_init_laravel_configurations()
|
||||
{
|
||||
$this->markTestIncomplete("@todo: Please correct this unit test");
|
||||
|
||||
$object = new System();
|
||||
$object->initLaravel();
|
||||
|
||||
@@ -59,4 +63,112 @@ class SystemTest extends TestCase
|
||||
$this->assertArrayHasKey('OAUTH_CLIENT_SECRET', $actual);
|
||||
$this->assertArrayHasKey('OAUTH_REFRESH_TOKEN', $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* It should return default system configuration parameters.
|
||||
* @test
|
||||
* @covers \ProcessMaker\Core\System::getSystemConfiguration()
|
||||
*/
|
||||
public function it_should_return_default_system_configuration_parameters()
|
||||
{
|
||||
$result = System::getSystemConfiguration();
|
||||
|
||||
$this->assertArrayHasKey('server_hostname_requests_frontend', $result);
|
||||
$this->assertArrayHasKey('disable_php_upload_execution', $result);
|
||||
$this->assertArrayHasKey('mobile_offline_tables_download_interval', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* It should return default system configuration parameters without workspace.
|
||||
* @test
|
||||
* @covers \ProcessMaker\Core\System::getSystemConfiguration()
|
||||
*/
|
||||
public function it_should_return_default_system_configuration_parameters_without_workspace()
|
||||
{
|
||||
config(["system.workspace" => '']);
|
||||
putenv("REQUEST_URI=/sysworkflow");
|
||||
|
||||
$result = System::getSystemConfiguration();
|
||||
|
||||
$this->assertArrayHasKey('server_hostname_requests_frontend', $result);
|
||||
$this->assertArrayHasKey('disable_php_upload_execution', $result);
|
||||
$this->assertArrayHasKey('mobile_offline_tables_download_interval', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* It should return system configuration parameters defined inside env file.
|
||||
* @test
|
||||
* @covers \ProcessMaker\Core\System::getSystemConfiguration()
|
||||
*/
|
||||
public function it_should_return_system_configuration_parameters_defined_inside_env_file()
|
||||
{
|
||||
$oldContent = "";
|
||||
$path = PATH_CONFIG . "env.ini";
|
||||
if (file_exists($path)) {
|
||||
$oldContent = file_get_contents($path);
|
||||
}
|
||||
|
||||
$expected = 30;
|
||||
|
||||
$content = "mobile_offline_tables_download_interval = {$expected};";
|
||||
file_put_contents($path, $content);
|
||||
|
||||
$result = System::getSystemConfiguration();
|
||||
$actual = $result['mobile_offline_tables_download_interval'];
|
||||
|
||||
file_put_contents($path, $oldContent);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* It should return default system configuration parameters defined inside env file when is not integer.
|
||||
* @test
|
||||
* @covers \ProcessMaker\Core\System::getSystemConfiguration()
|
||||
*/
|
||||
public function it_should_return_default_system_configuration_parameters_defined_inside_env_file_when_is_not_an_integer()
|
||||
{
|
||||
$oldContent = "";
|
||||
$path = PATH_CONFIG . "env.ini";
|
||||
if (file_exists($path)) {
|
||||
$oldContent = file_get_contents($path);
|
||||
}
|
||||
|
||||
$faker = $faker = Factory::create();
|
||||
$alphanumeric = $faker->regexify('[A-Za-z0-9]{20}');
|
||||
$content = "mobile_offline_tables_download_interval = '{$alphanumeric}';";
|
||||
file_put_contents($path, $content);
|
||||
|
||||
$result = System::getSystemConfiguration();
|
||||
|
||||
$expected = (string) $result['mobile_offline_tables_download_interval'];
|
||||
|
||||
file_put_contents($path, $oldContent);
|
||||
|
||||
$this->assertTrue(is_numeric($expected));
|
||||
}
|
||||
|
||||
/**
|
||||
* It should return proxy_pass defined inside env file.
|
||||
* @test
|
||||
* @covers \ProcessMaker\Core\System::getSystemConfiguration()
|
||||
*/
|
||||
public function it_should_return_proxy_pass_defined_inside_env_file()
|
||||
{
|
||||
$oldContent = "";
|
||||
$path = PATH_CONFIG . "env.ini";
|
||||
if (file_exists($path)) {
|
||||
$oldContent = file_get_contents($path);
|
||||
}
|
||||
|
||||
$faker = $faker = Factory::create();
|
||||
$content = "proxy_pass = '{$faker->password}';";
|
||||
file_put_contents($path, $content);
|
||||
|
||||
$result = System::getSystemConfiguration();
|
||||
|
||||
file_put_contents($path, $oldContent);
|
||||
|
||||
$this->assertArrayHasKey("proxy_pass", $result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
||||
|
||||
use ProcessMaker\Model\AdditionalTables;
|
||||
use ProcessMaker\Model\Fields;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdditionalTablesTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test belongs to ADD_TAB_UID
|
||||
*
|
||||
* @covers \ProcessMaker\Model\AdditionalTables::columns()
|
||||
* @test
|
||||
*/
|
||||
public function it_has_a_columns_defined()
|
||||
{
|
||||
$table = factory(AdditionalTables::class)->create([
|
||||
'ADD_TAB_UID' => function () {
|
||||
return factory(Fields::class)->create()->ADD_TAB_UID;
|
||||
}
|
||||
]);
|
||||
$this->assertInstanceOf(Fields::class, $table->columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test scope query to get the offline tables
|
||||
*
|
||||
* @covers \ProcessMaker\Model\AdditionalTables::scopeOffline()
|
||||
* @test
|
||||
*/
|
||||
public function it_filter_offline_table()
|
||||
{
|
||||
factory(AdditionalTables::class)->create(['ADD_TAB_OFFLINE' => 0]);
|
||||
$table = factory(AdditionalTables::class)->create([
|
||||
'ADD_TAB_OFFLINE' => 1
|
||||
]);
|
||||
$this->assertCount(1, $table->offline([$table->ADD_TAB_OFFLINE])->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get the structure of offline tables
|
||||
*
|
||||
* @covers \ProcessMaker\Model\AdditionalTables::getTablesOfflineStructure()
|
||||
* @test
|
||||
*/
|
||||
public function it_get_structure_from_offline_tables()
|
||||
{
|
||||
factory(Fields::class)->states('foreign_keys')->create();
|
||||
$results = AdditionalTables::getTablesOfflineStructure();
|
||||
$this->assertNotEmpty($results);
|
||||
foreach ($results as $row) {
|
||||
$this->assertArrayHasKey('add_tab_uid', $row);
|
||||
$this->assertArrayHasKey('add_tab_name', $row);
|
||||
$this->assertArrayHasKey('add_tab_description', $row);
|
||||
$this->assertArrayHasKey('add_tab_class_name', $row);
|
||||
$this->assertArrayHasKey('fields', $row);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get the data of offline tables
|
||||
*
|
||||
* @covers \ProcessMaker\Model\AdditionalTables::getTablesOfflineData()
|
||||
* @test
|
||||
*/
|
||||
public function it_get_data_from_offline_tables()
|
||||
{
|
||||
factory(Fields::class)->states('foreign_keys')->create();
|
||||
$results = AdditionalTables::getTablesOfflineData();
|
||||
$this->assertNotEmpty($results);
|
||||
foreach ($results as $row) {
|
||||
$this->assertArrayHasKey('add_tab_uid', $row);
|
||||
$this->assertArrayHasKey('add_tab_name', $row);
|
||||
$this->assertArrayHasKey('add_tab_description', $row);
|
||||
$this->assertArrayHasKey('add_tab_class_name', $row);
|
||||
$this->assertArrayHasKey('rows', $row);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\Process;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Class DelegationTest
|
||||
*
|
||||
* @coversDefaultClass \ProcessMaker\Model\Application
|
||||
*/
|
||||
class ApplicationTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
/**
|
||||
* This checks if return the columns used
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Application::getByProUid()
|
||||
* @test
|
||||
*/
|
||||
public function it_return_cases_by_process()
|
||||
{
|
||||
$process = factory(Process::class)->create();
|
||||
factory(Application::class, 5)->create(['PRO_UID' => $process->PRO_UID]);
|
||||
$cases = Application::getByProUid($process->PRO_UID);
|
||||
foreach ($cases as $case) {
|
||||
$this->assertEquals($case->PRO_UID, $process->PRO_UID);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks if return the columns used
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Application::getCase()
|
||||
* @test
|
||||
*/
|
||||
public function it_return_case_information()
|
||||
{
|
||||
$application = factory(Application::class)->create();
|
||||
$result = Application::getCase($application->APP_UID);
|
||||
$this->assertArrayHasKey('APP_STATUS', $result);
|
||||
$this->assertArrayHasKey('APP_INIT_USER', $result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
||||
|
||||
use ProcessMaker\Model\AdditionalTables;
|
||||
use ProcessMaker\Model\Fields;
|
||||
use Tests\TestCase;
|
||||
|
||||
class FieldsTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test belongs to ADD_TAB_UID
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Fields::table()
|
||||
* @test
|
||||
*/
|
||||
public function it_has_a_columns_defined()
|
||||
{
|
||||
$tableColumns = factory(Fields::class)->create([
|
||||
'ADD_TAB_UID' => function () {
|
||||
return factory(AdditionalTables::class)->create()->ADD_TAB_UID;
|
||||
}
|
||||
]);
|
||||
$this->assertInstanceOf(AdditionalTables::class, $tableColumns->table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test scope and the query with a specific ADD_TAB_UID
|
||||
*
|
||||
* @covers \ProcessMaker\Model\Fields::scopeTable()
|
||||
* @covers \ProcessMaker\Model\Fields::getFields()
|
||||
* @test
|
||||
*/
|
||||
public function it_get_fields_from_specific_table()
|
||||
{
|
||||
$fields = factory(Fields::class)->create();
|
||||
$result = Fields::getFields($fields->ADD_TAB_UID);
|
||||
$this->assertNotEmpty($result);
|
||||
}
|
||||
}
|
||||
@@ -16,10 +16,14 @@ class BpmnWorkflowTest extends TestCase
|
||||
{
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* Set up testing.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->user = factory(User::class)->create();
|
||||
Process::truncate();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,6 +162,10 @@ class BpmnWorkflowTest extends TestCase
|
||||
'PRJ_NAME' => $projectData['prj_name']
|
||||
]);
|
||||
|
||||
factory(\ProcessMaker\Model\Process::class)->create([
|
||||
'PRO_TITLE' => $projectData['prj_name']
|
||||
]);
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
$bpmnWorkflow->createFromStruct($projectData, true, null);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\Project;
|
||||
|
||||
use Exception;
|
||||
use Faker\Factory;
|
||||
use G;
|
||||
use ProcessMaker\Model\Dynaform;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\WebEntry;
|
||||
use ProcessMaker\Project\Workflow;
|
||||
use Tests\TestCase;
|
||||
|
||||
class WorkflowTest extends TestCase
|
||||
{
|
||||
private $workflow;
|
||||
private $directories;
|
||||
private $files;
|
||||
private $faker;
|
||||
|
||||
/**
|
||||
* This method sets the values before starting any test.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
$this->workflow = new Workflow();
|
||||
$this->directories = [];
|
||||
$this->files = [];
|
||||
$this->faker = Factory::create();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is executed after each test.
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
foreach ($this->files as $value) {
|
||||
unlink($value);
|
||||
}
|
||||
foreach ($this->directories as $value) {
|
||||
rmdir($value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This test ensures that the getData method returns the correct data.
|
||||
* @test
|
||||
* @covers \ProcessMaker\Project\Workflow::getData()
|
||||
*/
|
||||
public function it_should_return_the_data_when_the_project_id_is_valid()
|
||||
{
|
||||
$process = factory(Process::class)->create();
|
||||
$dynaforms = factory(Dynaform::class, 5)->create([
|
||||
'PRO_UID' => $process->PRO_UID
|
||||
]);
|
||||
factory(WebEntry::class, 5)->create([
|
||||
'PRO_UID' => $process->PRO_UID
|
||||
]);
|
||||
|
||||
//xmlForms
|
||||
if (!is_dir(PATH_DYNAFORM)) {
|
||||
mkdir(PATH_DYNAFORM);
|
||||
}
|
||||
$directory = PATH_DYNAFORM . $process->PRO_UID . "/";
|
||||
$this->directories[] = $directory;
|
||||
mkdir($directory);
|
||||
foreach ($dynaforms as $dynaform) {
|
||||
Dynaform::where('PRO_UID', $process->PRO_UID)
|
||||
->where('DYN_UID', $dynaform->DYN_UID)
|
||||
->update(['DYN_FILENAME' => $process->PRO_UID . '/' . $dynaform->DYN_UID]);
|
||||
|
||||
$dynUid = $dynaform->DYN_UID;
|
||||
$data = '';
|
||||
$filename = $directory . $dynUid . ".xml";
|
||||
$this->files[] = $filename;
|
||||
file_put_contents($filename, $data);
|
||||
|
||||
$filename = $directory . $dynUid . ".html";
|
||||
$this->files[] = $filename;
|
||||
file_put_contents($filename, $data);
|
||||
}
|
||||
|
||||
//template
|
||||
if (!is_dir(PATH_DATA_MAILTEMPLATES)) {
|
||||
mkdir(PATH_DATA_MAILTEMPLATES);
|
||||
}
|
||||
$directory = PATH_DATA_MAILTEMPLATES . $process->PRO_UID;
|
||||
$this->directories[] = $directory;
|
||||
mkdir($directory);
|
||||
|
||||
$filename = $directory . "/test.html";
|
||||
$this->files[] = $filename;
|
||||
file_put_contents($filename, '');
|
||||
|
||||
//public files
|
||||
if (!is_dir(PATH_DATA_PUBLIC)) {
|
||||
mkdir(PATH_DATA_PUBLIC);
|
||||
}
|
||||
$directory = PATH_DATA_PUBLIC . $process->PRO_UID;
|
||||
$this->directories[] = $directory;
|
||||
mkdir($directory);
|
||||
|
||||
$filename = $directory . "/wsClient.php";
|
||||
$this->files[] = $filename;
|
||||
file_put_contents($filename, '');
|
||||
|
||||
$actual = $this->workflow->getData($process->PRO_UID);
|
||||
|
||||
$this->assertCount(2, $actual);
|
||||
$this->assertArrayHasKey('process', $actual[0]);
|
||||
$this->assertArrayHasKey('DYNAFORMS', $actual[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test should throw an exception when the parameter is not correct.
|
||||
* @test
|
||||
* @covers \ProcessMaker\Project\Workflow::getData()
|
||||
*/
|
||||
public function it_should_throw_exception_when_get_data_is_failed()
|
||||
{
|
||||
$proUid = $this->faker->regexify("/[a-zA-Z]{32}/");
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
$actual = $this->workflow->getData($proUid);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user