solved conflict composer.lock, config/app.php, workflow/engine/classes/SpoolRun.php
This commit is contained in:
@@ -13,7 +13,6 @@ class Kernel extends ConsoleKernel
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
Commands\PMTranslationsPlugins::class
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -34,6 +33,6 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
|
||||
$this->load(__DIR__ . '/Commands');
|
||||
}
|
||||
}
|
||||
|
||||
22
app/Logging/CustomizeFormatter.php
Normal file
22
app/Logging/CustomizeFormatter.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Logging;
|
||||
|
||||
use Monolog\Formatter\LineFormatter;
|
||||
|
||||
class CustomizeFormatter
|
||||
{
|
||||
|
||||
/**
|
||||
* Customize the given logger instance.
|
||||
*
|
||||
* @param \Illuminate\Log\Logger $logger
|
||||
* @return void
|
||||
*/
|
||||
public function __invoke($logger)
|
||||
{
|
||||
foreach ($logger->getHandlers() as $handler) {
|
||||
$handler->setFormatter(new LineFormatter(null, null, true, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,17 +50,6 @@ $app->singleton(
|
||||
Handler::class
|
||||
);
|
||||
|
||||
$app->configureMonologUsing(function ($monolog) use ($app) {
|
||||
$monolog->pushHandler(
|
||||
(new RotatingFileHandler(
|
||||
// Set the log path
|
||||
$app->storagePath() . '/logs/processmaker.log',
|
||||
// Set the number of daily files you want to keep
|
||||
$app->make('config')->get('app.log_max_files', 5)
|
||||
))->setFormatter(new LineFormatter(null, null, true, true))
|
||||
);
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Return The Application
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=5.6",
|
||||
"laravel/framework": "5.4.*",
|
||||
"php": ">=7.1",
|
||||
"laravel/framework": "5.7.*",
|
||||
"luracast/restler": "^3.0",
|
||||
"bshaffer/oauth2-server-php": "v1.0",
|
||||
"colosa/pmUI": "release/3.3.1-dev",
|
||||
@@ -43,7 +43,7 @@
|
||||
"phpmailer/phpmailer": "5.2.27",
|
||||
"pear/archive_tar": "1.4.*",
|
||||
"pear/console_getopt": "1.4.*",
|
||||
"TYPO3/class-alias-loader": "^1.0",
|
||||
"typo3/class-alias-loader": "^1.0",
|
||||
"ralouphie/getallheaders": "^2.0",
|
||||
"smarty/smarty": "2.6.30",
|
||||
"pdepend/pdepend": "@stable",
|
||||
@@ -57,7 +57,7 @@
|
||||
"fzaninotto/faker": "^1.7",
|
||||
"guzzlehttp/guzzle": "^6.3",
|
||||
"phpunit/phpunit": "~5.7",
|
||||
"lmc/steward": "^2.2",
|
||||
"filp/whoops": "~2.0",
|
||||
"behat/behat": "^3.3",
|
||||
"behat/mink-selenium2-driver": "^1.3",
|
||||
"squizlabs/php_codesniffer": "^2.2 || ^3.0.2",
|
||||
@@ -103,7 +103,11 @@
|
||||
},
|
||||
"scripts": {
|
||||
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/wimg/php-compatibility",
|
||||
"post-update-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/wimg/php-compatibility"
|
||||
"post-update-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/wimg/php-compatibility",
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"typo3/class-alias-loader": {
|
||||
|
||||
3511
composer.lock
generated
3511
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -9,24 +9,23 @@ return [
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
'debug' => env('APP_DEBUG', false),
|
||||
'log' => env('APP_LOG', 'single'),
|
||||
'log_level' => env('APP_LOG_LEVEL', 'debug'),
|
||||
'cache_lifetime' => env('APP_CACHE_LIFETIME', 60),
|
||||
'key' => env('APP_KEY', 'base64:rU28h/tElUn/eiLY0qC24jJq1rakvAFRoRl1DWxj/kM='),
|
||||
'cipher' => 'AES-256-CBC',
|
||||
'timezone' => 'UTC',
|
||||
'providers' => [
|
||||
CacheServiceProvider::class,
|
||||
FilesystemServiceProvider::class,
|
||||
CacheServiceProvider::class,
|
||||
ViewServiceProvider::class,
|
||||
Illuminate\Database\DatabaseServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
||||
Illuminate\Queue\QueueServiceProvider::class,
|
||||
Illuminate\Translation\TranslationServiceProvider::class,
|
||||
Illuminate\Encryption\EncryptionServiceProvider::class,
|
||||
Laravel\Tinker\TinkerServiceProvider::class,
|
||||
ViewServiceProvider::class,
|
||||
|
||||
Illuminate\Notifications\NotificationServiceProvider::class,
|
||||
],
|
||||
|
||||
'aliases' => [
|
||||
'Crypt' => Illuminate\Support\Facades\Crypt::class
|
||||
],
|
||||
|
||||
@@ -70,6 +70,7 @@ workflow/engine/methods/setup/jasper.php
|
||||
workflow/engine/methods/setup/webServices.php
|
||||
workflow/engine/methods/setup/webServicesAjax.php
|
||||
workflow/engine/methods/setup/webServicesList.php
|
||||
workflow/engine/methods/users/data_usersList.php
|
||||
workflow/engine/plugins/openFlash.php
|
||||
workflow/engine/plugins/openFlash/chart-data.php
|
||||
workflow/engine/plugins/openFlash/chart.php
|
||||
|
||||
85
config/logging.php
Normal file
85
config/logging.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\StreamHandler;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that gets used when writing
|
||||
| messages to the logs. The name specified in this option should match
|
||||
| one of the channels defined in the "channels" configuration array.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('APP_LOG', env('LOG_CHANNEL', 'daily')),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Out of
|
||||
| the box, Laravel uses the Monolog PHP logging library. This gives
|
||||
| you a variety of powerful log handlers / formatters to utilize.
|
||||
|
|
||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog",
|
||||
| "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['single'],
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/processmaker.log'),
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'tap' => [
|
||||
App\Logging\CustomizeFormatter::class
|
||||
],
|
||||
'path' => storage_path('logs/processmaker.log'),
|
||||
'level' => env('APP_LOG_LEVEL', 'debug'),
|
||||
'days' => $app->make('config')->get('app.log_max_files', 5),
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => 'Laravel Log',
|
||||
'emoji' => ':boom:',
|
||||
'level' => 'critical',
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => StreamHandler::class,
|
||||
'with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
@@ -4,16 +4,18 @@
|
||||
* Model factory for a dynaform.
|
||||
*/
|
||||
use Faker\Generator as Faker;
|
||||
use ProcessMaker\Model\Dynaform;
|
||||
use ProcessMaker\Model\Process;
|
||||
|
||||
$factory->define(\ProcessMaker\Model\Dynaform::class, function(Faker $faker) {
|
||||
$factory->define(Dynaform::class, function(Faker $faker) {
|
||||
$date = $faker->dateTime();
|
||||
return [
|
||||
'DYN_UID' => G::generateUniqueID(),
|
||||
'DYN_ID' => '',
|
||||
'DYN_TITLE' => '',
|
||||
'DYN_DESCRIPTION' => '',
|
||||
'DYN_ID' => $faker->unique()->numberBetween(1, 10000),
|
||||
'DYN_TITLE' => $faker->sentence(2),
|
||||
'DYN_DESCRIPTION' => $faker->sentence(5),
|
||||
'PRO_UID' => function() {
|
||||
$process = factory(\ProcessMaker\Model\Process::class)->create();
|
||||
$process = factory(Process::class)->create();
|
||||
return $process->PRO_UID;
|
||||
},
|
||||
'DYN_TYPE' => 'xmlform',
|
||||
|
||||
30
database/factories/InputDocumentFactory.php
Normal file
30
database/factories/InputDocumentFactory.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Model factory for a input document.
|
||||
*/
|
||||
use Faker\Generator as Faker;
|
||||
use ProcessMaker\Model\InputDocument;
|
||||
use ProcessMaker\Model\Process;
|
||||
|
||||
$factory->define(InputDocument::class, function(Faker $faker) {
|
||||
return [
|
||||
'INP_DOC_UID' => G::generateUniqueID(),
|
||||
'INP_DOC_ID' => $faker->unique()->numberBetween(1, 10000),
|
||||
'PRO_UID' => function() {
|
||||
$process = factory(Process::class)->create();
|
||||
return $process->PRO_UID;
|
||||
},
|
||||
'INP_DOC_TITLE' => $faker->sentence(2),
|
||||
'INP_DOC_DESCRIPTION' => $faker->sentence(10),
|
||||
'INP_DOC_FORM_NEEDED' => 'VIRTUAL',
|
||||
'INP_DOC_ORIGINAL' => 'ORIGINAL',
|
||||
'INP_DOC_PUBLISHED' => 'PRIVATE',
|
||||
'INP_DOC_VERSIONING' => 0,
|
||||
'INP_DOC_DESTINATION_PATH' => '',
|
||||
'INP_DOC_TAGS' => 'INPUT',
|
||||
'INP_DOC_TYPE_FILE' => '.*',
|
||||
'INP_DOC_MAX_FILESIZE' => 0,
|
||||
'INP_DOC_MAX_FILESIZE_UNIT' => 'KB'
|
||||
];
|
||||
});
|
||||
43
database/factories/OutputDocumentFactory.php
Normal file
43
database/factories/OutputDocumentFactory.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Model factory for a output document.
|
||||
*/
|
||||
use Faker\Generator as Faker;
|
||||
use ProcessMaker\Model\OutputDocument;
|
||||
use ProcessMaker\Model\Process;
|
||||
|
||||
$factory->define(OutputDocument::class, function(Faker $faker) {
|
||||
$date = $faker->dateTime();
|
||||
return [
|
||||
'OUT_DOC_UID' => G::generateUniqueID(),
|
||||
'OUT_DOC_ID' => $faker->unique()->numberBetween(1, 10000),
|
||||
'OUT_DOC_TITLE' => $faker->sentence(2),
|
||||
'OUT_DOC_DESCRIPTION' => $faker->sentence(10),
|
||||
'OUT_DOC_FILENAME' => $faker->sentence(2),
|
||||
'OUT_DOC_TEMPLATE' => '',
|
||||
'PRO_UID' => function() {
|
||||
$process = factory(Process::class)->create();
|
||||
return $process->PRO_UID;
|
||||
},
|
||||
'OUT_DOC_REPORT_GENERATOR' => 'TCPDF',
|
||||
'OUT_DOC_LANDSCAPE' => 0,
|
||||
'OUT_DOC_MEDIA' => 'Letter',
|
||||
'OUT_DOC_LEFT_MARGIN' => 20,
|
||||
'OUT_DOC_RIGHT_MARGIN' => 20,
|
||||
'OUT_DOC_TOP_MARGIN' => 20,
|
||||
'OUT_DOC_BOTTOM_MARGIN' => 20,
|
||||
'OUT_DOC_GENERATE' => 'BOTH',
|
||||
'OUT_DOC_TYPE' => 'HTML',
|
||||
'OUT_DOC_CURRENT_REVISION' => 0,
|
||||
'OUT_DOC_FIELD_MAPPING' => '',
|
||||
'OUT_DOC_VERSIONING' => 1,
|
||||
'OUT_DOC_DESTINATION_PATH' => '',
|
||||
'OUT_DOC_TAGS' => '',
|
||||
'OUT_DOC_PDF_SECURITY_ENABLED' => 0,
|
||||
'OUT_DOC_PDF_SECURITY_OPEN_PASSWORD' => '',
|
||||
'OUT_DOC_PDF_SECURITY_OWNER_PASSWORD' => '',
|
||||
'OUT_DOC_PDF_SECURITY_PERMISSIONS' => '',
|
||||
'OUT_DOC_OPEN_TYPE' => 1
|
||||
];
|
||||
});
|
||||
21
database/factories/ProcessVariablesFactory.php
Normal file
21
database/factories/ProcessVariablesFactory.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use ProcessMaker\Model\ProcessVariables;
|
||||
|
||||
$factory->define(ProcessVariables::class, function (Faker $faker) {
|
||||
return [
|
||||
'VAR_UID' => G::generateUniqueID(),
|
||||
'PRJ_UID' => G::generateUniqueID(),
|
||||
'VAR_NAME' => $faker->word,
|
||||
'VAR_FIELD_TYPE' => G::generateUniqueID(),
|
||||
'VAR_FIELD_SIZE' => 10,
|
||||
'VAR_LABEL' => 'string',
|
||||
'VAR_DBCONNECTION' => 'workflow',
|
||||
'VAR_SQL' => '',
|
||||
'VAR_NULL' => 0,
|
||||
'VAR_DEFAULT' => '',
|
||||
'VAR_ACCEPTED_VALUES' => '',
|
||||
'INP_DOC_UID' => ''
|
||||
];
|
||||
});
|
||||
16
database/factories/TriggerFactory.php
Normal file
16
database/factories/TriggerFactory.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use ProcessMaker\Model\Triggers;
|
||||
|
||||
$factory->define(Triggers::class, function (Faker $faker) {
|
||||
return [
|
||||
'TRI_UID' => G::generateUniqueID(),
|
||||
'TRI_TITLE' => $faker->sentence(5),
|
||||
'TRI_DESCRIPTION' => $faker->text,
|
||||
'PRO_UID' => G::generateUniqueID(),
|
||||
'TRI_TYPE' => 'SCRIPT',
|
||||
'TRI_WEBBOT' => $faker->text,
|
||||
'TRI_PARAM' => '',
|
||||
];
|
||||
});
|
||||
@@ -1839,7 +1839,7 @@ class Bootstrap
|
||||
*
|
||||
* @return multitype:string mixed Ambigous <number, string>
|
||||
*/
|
||||
public function parseNormalUri($aRequestUri, array $arrayFriendlyUri = null)
|
||||
public static function parseNormalUri($aRequestUri, array $arrayFriendlyUri = null)
|
||||
{
|
||||
if (substr($aRequestUri[1], 0, 3) == 'sys') {
|
||||
define('SYS_TEMP', substr($aRequestUri[1], 3));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -213,7 +213,7 @@ class RBAC
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function &getSingleton()
|
||||
public static function &getSingleton()
|
||||
{
|
||||
if (self::$instance == null) {
|
||||
self::$instance = new RBAC();
|
||||
|
||||
11
phpunit.xml
11
phpunit.xml
@@ -15,7 +15,10 @@
|
||||
<directory>./tests/workflow/engine/src/</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
<directory suffix="Test.php">./tests/unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Performance">
|
||||
<directory>./tests/Performance/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
@@ -33,6 +36,10 @@
|
||||
</filter>
|
||||
|
||||
<php>
|
||||
<!--Main environment-->
|
||||
<env name="MAIN_SYS_SYS" value="workflow" />
|
||||
<env name="MAIN_TIME_ZONE" value="America/New_York" />
|
||||
<env name="MAIN_SYSTEM_UTC_TIME_ZONE" value="1" />
|
||||
<!--Connection to database-->
|
||||
<env name="DB_HOST" value="127.0.0.1" />
|
||||
<env name="DB_DATABASE" value="test" />
|
||||
@@ -45,6 +52,8 @@
|
||||
<env name="MSSQL_DATABASE" value="testexternal" />
|
||||
<env name="MSSQL_USERNAME" value="test" />
|
||||
<env name="MSSQL_PASSWORD" value="test" />
|
||||
<!--Performance Mysql test-->
|
||||
<env name="RUN_MYSQL_PERFORMANCE_TESTS" value="false" />
|
||||
<!--Php variables-->
|
||||
<var name="APP_ENV" value="testing" />
|
||||
<var name="SYS_SYS" value="test" />
|
||||
|
||||
@@ -1,43 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Queue\Console\WorkCommand;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use ProcessMaker\Model\DbSource;
|
||||
use ProcessMaker\Model\Process;
|
||||
use Tests\TestCase;
|
||||
use Propel;
|
||||
use DbConnections;
|
||||
|
||||
class DBQueryTest extends TestCase
|
||||
{
|
||||
|
||||
use DatabaseTransactions;
|
||||
|
||||
/**
|
||||
* A basic cache example.
|
||||
*
|
||||
* @return void
|
||||
* Sets up the unit tests.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the execution of a common SQL statement.
|
||||
* @test
|
||||
*/
|
||||
public function testStandardExecuteQuery()
|
||||
{
|
||||
$results = executeQuery("SELECT * FROM USERS WHERE USR_UID = '00000000000000000000000000000001'");
|
||||
$this->assertCount(1, $results);
|
||||
// Note, we check index 1 because results from executeQuery are 1 indexed, not 0 indexed.
|
||||
$this->assertArraySubset([
|
||||
$expected = [
|
||||
'USR_UID' => '00000000000000000000000000000001',
|
||||
'USR_USERNAME' => 'admin'
|
||||
], $results[1]);
|
||||
];
|
||||
$this->assertArraySubset($expected, $results[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the existence of the admin user.
|
||||
* @test
|
||||
*/
|
||||
public function testDBFacadeQuery()
|
||||
{
|
||||
$record = DB::table('USERS')->where([
|
||||
'USR_UID' => '00000000000000000000000000000001'
|
||||
])->first();
|
||||
$record = DB::table('USERS')->where('USR_UID', '=', '00000000000000000000000000000001')->first();
|
||||
$this->assertEquals('admin', $record->USR_USERNAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the execution of a SQL statement common to an MySQL external database.
|
||||
* @test
|
||||
*/
|
||||
public function testStandardExecuteQueryWithExternalMySQLDatabase()
|
||||
{
|
||||
// Our test external database is created in our tests/bootstrap.php file
|
||||
@@ -45,12 +58,12 @@ class DBQueryTest extends TestCase
|
||||
$process = factory(Process::class)->create();
|
||||
// Let's create an external DB to ourselves
|
||||
$externalDB = factory(DbSource::class)->create([
|
||||
'DBS_SERVER' => 'localhost',
|
||||
'DBS_SERVER' => config('database.connections.testexternal.host'),
|
||||
'DBS_PORT' => '3306',
|
||||
'DBS_USERNAME' => env('DB_USERNAME'),
|
||||
'DBS_USERNAME' => config('database.connections.testexternal.username'),
|
||||
// Remember, we have to do some encryption here @see DbSourceFactory.php
|
||||
'DBS_PASSWORD' => \G::encrypt( env('DB_PASSWORD'), 'testexternal') . "_2NnV3ujj3w",
|
||||
'DBS_DATABASE_NAME' => 'testexternal',
|
||||
'DBS_PASSWORD' => \G::encrypt(env('DB_PASSWORD'), config('database.connections.testexternal.database')) . "_2NnV3ujj3w",
|
||||
'DBS_DATABASE_NAME' => config('database.connections.testexternal.database'),
|
||||
'PRO_UID' => $process->PRO_UID
|
||||
]);
|
||||
|
||||
@@ -65,9 +78,13 @@ class DBQueryTest extends TestCase
|
||||
$this->assertEquals('testvalue', $results[1]['value']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the execution of a SQL statement common to an MSSQL external database.
|
||||
* @test
|
||||
*/
|
||||
public function testStandardExecuteQueryWithExternalMSSqlDatabase()
|
||||
{
|
||||
if(!env('RUN_MSSQL_TESTS')) {
|
||||
if (!env('RUN_MSSQL_TESTS')) {
|
||||
$this->markTestSkipped('MSSQL Related Test Skipped');
|
||||
}
|
||||
// Our test external database is created in our tests/bootstrap.php file
|
||||
@@ -80,8 +97,8 @@ class DBQueryTest extends TestCase
|
||||
'DBS_TYPE' => 'mssql',
|
||||
'DBS_USERNAME' => env('MSSQL_USERNAME'),
|
||||
// Remember, we have to do some encryption here @see DbSourceFactory.php
|
||||
'DBS_PASSWORD' => \G::encrypt( env('MSSQL_PASSWORD'), 'testexternal') . "_2NnV3ujj3w",
|
||||
'DBS_DATABASE_NAME' => 'testexternal',
|
||||
'DBS_PASSWORD' => \G::encrypt(env('MSSQL_PASSWORD'), env('MSSQL_DATABASE')) . "_2NnV3ujj3w",
|
||||
'DBS_DATABASE_NAME' => env('MSSQL_DATABASE'),
|
||||
'PRO_UID' => $process->PRO_UID
|
||||
]);
|
||||
// Now set our process ID
|
||||
@@ -94,4 +111,4 @@ class DBQueryTest extends TestCase
|
||||
$this->assertCount(1, $results);
|
||||
$this->assertEquals('testvalue', $results[1]['value']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,26 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use PDO;
|
||||
use PHPUnit\Framework\TestCase as TestCaseFramework;
|
||||
use ProcessMaker\Importer\XmlImporter;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Test case that could instance a workspace DB
|
||||
*
|
||||
*/
|
||||
class WorkflowTestCase extends TestCase
|
||||
class WorkflowTestCase extends TestCaseFramework
|
||||
{
|
||||
private $host;
|
||||
private $user;
|
||||
private $password;
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Create and install the database.
|
||||
*/
|
||||
protected function setupDB()
|
||||
{
|
||||
$this->host = env("DB_HOST");
|
||||
$this->user = env("DB_USERNAME");
|
||||
$this->password = env("DB_PASSWORD");
|
||||
$this->database = env("DB_DATABASE");
|
||||
//Install Database
|
||||
$pdo0 = new PDO("mysql:host=".DB_HOST, DB_USER, DB_PASS);
|
||||
$pdo0->query('DROP DATABASE IF EXISTS '.DB_NAME);
|
||||
$pdo0->query('CREATE DATABASE '.DB_NAME);
|
||||
$pdo = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME, DB_USER,
|
||||
DB_PASS);
|
||||
$pdo0 = new PDO("mysql:host=".$this->host, $this->user, $this->password);
|
||||
$pdo0->query('DROP DATABASE IF EXISTS '.$this->database);
|
||||
$pdo0->query('CREATE DATABASE '.$this->database);
|
||||
$pdo = new PDO("mysql:host=".$this->host.";dbname=".$this->database, $this->user,
|
||||
$this->password);
|
||||
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
|
||||
$pdo->exec(file_get_contents(PATH_CORE.'data/mysql/schema.sql'));
|
||||
$pdo->exec(file_get_contents(PATH_RBAC_CORE.'data/mysql/schema.sql'));
|
||||
@@ -39,8 +50,8 @@ class WorkflowTestCase extends TestCase
|
||||
protected function dropDB()
|
||||
{
|
||||
//Install Database
|
||||
$pdo0 = new PDO("mysql:host=".DB_HOST, DB_USER, DB_PASS);
|
||||
$pdo0->query('DROP DATABASE IF EXISTS '.DB_NAME);
|
||||
$pdo0 = new PDO("mysql:host=".$this->host, $this->user, $this->password);
|
||||
$pdo0->query('DROP DATABASE IF EXISTS '.$this->database);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,31 +14,66 @@ use Illuminate\Support\Facades\Schema;
|
||||
/**
|
||||
* @todo Migrate to configuration parameters
|
||||
*/
|
||||
|
||||
define('PATH_TRUNK', dirname(__DIR__));
|
||||
define('PATH_CORE', PATH_TRUNK.'/workflow/engine/');
|
||||
define('PATH_CORE', PATH_TRUNK . '/workflow/engine/');
|
||||
define('PATH_CONFIG', PATH_CORE . 'config/');
|
||||
define('PATH_RBAC_CORE',dirname(__DIR__).'/rbac/engine/');
|
||||
define('PATH_DB', dirname(__DIR__).'/shared/sites/');
|
||||
define('PATH_DATA', dirname(__DIR__).'/shared/rbac/');
|
||||
$pathData = PATH_CONFIG . 'paths_installed.php';
|
||||
if (file_exists($pathData)) {
|
||||
require_once $pathData;
|
||||
} else {
|
||||
define('PATH_DATA', dirname(__DIR__) . '/shared/rbac/');
|
||||
}
|
||||
define('PATH_RBAC_CORE', dirname(__DIR__) . '/rbac/engine/');
|
||||
define('PATH_DB', dirname(__DIR__) . '/shared/sites/');
|
||||
define('PATH_SEP', '/');
|
||||
define('PATH_METHODS', dirname(__DIR__).'/workflow/engine/methods/');
|
||||
define('PATH_METHODS', dirname(__DIR__) . '/workflow/engine/methods/');
|
||||
define('SYS_LANG', 'en');
|
||||
define('DB_ADAPTER', 'mysql');
|
||||
define('SYS_SKIN', 'neoclassic');
|
||||
define('SYS_SYS', 'workflow');
|
||||
define('PATH_WORKSPACE',PATH_TRUNK.'/shared/sites/' . SYS_SYS . '/');
|
||||
define('PMTABLE_KEY','pmtable');
|
||||
define('SYS_SYS', env('MAIN_SYS_SYS', 'workflow'));
|
||||
define('PATH_WORKSPACE', PATH_TRUNK . '/shared/sites/' . SYS_SYS . '/');
|
||||
define('PMTABLE_KEY', 'pmtable');
|
||||
define('PATH_WORKFLOW_MYSQL_DATA', PATH_TRUNK . '/workflow/engine/data/mysql/');
|
||||
define('PATH_RBAC_MYSQL_DATA', PATH_TRUNK . '/rbac/engine/data/mysql/');
|
||||
define('PATH_LANGUAGECONT', PATH_DATA . '/META-INF/');
|
||||
define('DB_ADAPTER', 'mysql');
|
||||
define('PATH_RBAC_HOME', PATH_TRUNK . '/rbac/');
|
||||
define('PATH_RBAC', PATH_RBAC_HOME . 'engine/classes/');
|
||||
define("PATH_CUSTOM_SKINS", PATH_DATA . "skins/");
|
||||
define("PATH_TPL", PATH_CORE . "templates/");
|
||||
|
||||
//timezone
|
||||
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int) (env('MAIN_SYSTEM_UTC_TIME_ZONE', 'workflow')) == 1;
|
||||
|
||||
//Set Time Zone
|
||||
ini_set('date.timezone', $_SESSION['__SYSTEM_UTC_TIME_ZONE__'] ? 'UTC' : env('MAIN_TIME_ZONE', 'America/New_York'));
|
||||
define('TIME_ZONE', ini_get('date.timezone'));
|
||||
|
||||
// Setup basic app services
|
||||
$app = require __DIR__ . '/../bootstrap/app.php';
|
||||
$app->make(Kernel::class)->bootstrap();
|
||||
|
||||
//Overwrite with the Processmaker env.ini configuration used in production environments
|
||||
//@todo: move env.ini configuration to .env
|
||||
ini_set('date.timezone', TIME_ZONE); //Set Time Zone
|
||||
date_default_timezone_set(TIME_ZONE);
|
||||
config(['app.timezone' => TIME_ZONE]);
|
||||
|
||||
//configuration values
|
||||
config([
|
||||
"system.workspace" => SYS_SYS
|
||||
]);
|
||||
define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("system.workspace") . "/");
|
||||
define("PATH_DYNAFORM", PATH_DATA_SITE . "xmlForms/");
|
||||
define("PATH_DATA_MAILTEMPLATES", PATH_DATA_SITE . "mailTemplates/");
|
||||
define("PATH_DATA_PUBLIC", PATH_DATA_SITE . "public/");
|
||||
|
||||
G::defineConstants();
|
||||
|
||||
// Setup our testexternal database
|
||||
config(['database.connections.testexternal' => [
|
||||
'driver' => 'mysql',
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'database' => env('DB_DATABASE', 'testexternal'),
|
||||
'database' => 'testexternal',
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', 'password'),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
|
||||
72
tests/unit/app/CustomizeFormatterTest.php
Normal file
72
tests/unit/app/CustomizeFormatterTest.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\app;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CustomizeFormatterTest extends TestCase
|
||||
{
|
||||
private static $directory;
|
||||
|
||||
/**
|
||||
* This is executed for each test.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
self::$directory = PATH_TRUNK . '/storage/logs/';
|
||||
}
|
||||
|
||||
/**
|
||||
* This is done before the first test.
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$file = new Filesystem();
|
||||
$file->cleanDirectory(self::$directory);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is done after the last test.
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
$file = new Filesystem();
|
||||
$file->cleanDirectory(self::$directory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all of the log levels defined in the RFC 5424 specification.
|
||||
* @return array
|
||||
*/
|
||||
public function levelProviders()
|
||||
{
|
||||
return [
|
||||
['emergency', 'production.EMERGENCY'],
|
||||
['alert', 'production.ALERT'],
|
||||
['critical', 'production.CRITICAL'],
|
||||
['error', 'production.ERROR'],
|
||||
['warning', 'production.WARNING'],
|
||||
['notice', 'production.NOTICE'],
|
||||
['info', 'production.INFO'],
|
||||
['debug', 'production.DEBUG'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* This check the creation of a record with the emergency level.
|
||||
* @test
|
||||
* @dataProvider levelProviders
|
||||
*/
|
||||
public function it_should_create_log_file_levels($level, $message)
|
||||
{
|
||||
Log::{$level}($level);
|
||||
$files = File::allFiles(self::$directory);
|
||||
$this->assertCount(1, $files);
|
||||
|
||||
$string = File::get($files[0]);
|
||||
$this->assertRegExp("/{$message}/", $string);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
353
tests/unit/gulliver/system/gTest.php
Executable file
353
tests/unit/gulliver/system/gTest.php
Executable file
File diff suppressed because it is too large
Load Diff
274
tests/unit/workflow/engine/bin/tasks/CliWorkspacesTest.php
Normal file
274
tests/unit/workflow/engine/bin/tasks/CliWorkspacesTest.php
Normal file
File diff suppressed because one or more lines are too long
419
tests/unit/workflow/engine/classes/ProcessesTest.php
Normal file
419
tests/unit/workflow/engine/classes/ProcessesTest.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -9,13 +9,13 @@ use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PmDynaformTest extends TestCase
|
||||
class ReportTablesTest extends TestCase
|
||||
{
|
||||
|
||||
use DatabaseTransactions;
|
||||
|
||||
/**
|
||||
* Constructor of the class.
|
||||
* Sets up the unit tests.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
|
||||
68
tests/unit/workflow/engine/classes/SpoolRunTest.php
Normal file
68
tests/unit/workflow/engine/classes/SpoolRunTest.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
use Faker\Factory;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SpoolRunTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Constructor of the class.
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if "envelope_cc" and "envelope_bcc" was set correctly in consecutive calls
|
||||
*
|
||||
* @covers SpoolRun::setData()
|
||||
*
|
||||
* @test
|
||||
*/
|
||||
public function it_should_check_if_cc_and_bcc_set_correctly_in_consecutive_calls()
|
||||
{
|
||||
// Initializing Faker instance
|
||||
$faker = Factory::create();
|
||||
|
||||
// Instancing SpoolRun class
|
||||
$spoolRun = new SpoolRun();
|
||||
|
||||
// Set a first set of data
|
||||
$spoolRun->setData(
|
||||
G::generateUniqueID(),
|
||||
$faker->words(3, true),
|
||||
$faker->companyEmail,
|
||||
$faker->freeEmail,
|
||||
$faker->text(),
|
||||
$faker->dateTime()->format('Y-m-d H:i:s'),
|
||||
$faker->companyEmail,
|
||||
$faker->freeEmail
|
||||
);
|
||||
|
||||
// Build the "to", "cc" an "bcc" values
|
||||
$spoolRun->runHandleEnvelopeTo();
|
||||
|
||||
// Set a second set of data
|
||||
$spoolRun->setData(
|
||||
G::generateUniqueID(),
|
||||
$faker->words(3, true),
|
||||
$faker->companyEmail,
|
||||
$faker->freeEmail,
|
||||
$faker->text(),
|
||||
$faker->dateTime()->format('Y-m-d H:i:s'),
|
||||
$faker->companyEmail,
|
||||
$faker->freeEmail
|
||||
);
|
||||
|
||||
// Build the "to", "cc" an "bcc" values
|
||||
$spoolRun->runHandleEnvelopeTo();
|
||||
|
||||
// Get data to check
|
||||
$fileData = $spoolRun->getFileData();
|
||||
|
||||
// Asserts
|
||||
$this->assertCount(1, $fileData['envelope_to']);
|
||||
$this->assertCount(1, $fileData['envelope_cc']);
|
||||
$this->assertCount(1, $fileData['envelope_bcc']);
|
||||
}
|
||||
}
|
||||
@@ -37,13 +37,6 @@ class GroupTest extends TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
//Move section
|
||||
global $RBAC;
|
||||
$RBAC->initRBAC();
|
||||
$RBAC->loadUserRolePermission($RBAC->sSystem, '00000000000000000000000000000001');
|
||||
|
||||
$this->setInstanceGroup(new Group());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\BusinessModel;
|
||||
|
||||
use ProcessMaker\BusinessModel\Language;
|
||||
use System;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Test the ProcessMaker\BusinessModel\Language class.
|
||||
*/
|
||||
class LanguageTest extends \WorkflowTestCase
|
||||
class LanguageTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var Language
|
||||
@@ -18,18 +22,35 @@ class LanguageTest extends \WorkflowTestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->setupDB();
|
||||
$this->getBaseUri();
|
||||
$this->object = new Language;
|
||||
$this->translationEnv = PATH_DATA."META-INF".PATH_SEP."translations.env";
|
||||
$this->translationEnv = PATH_DATA . "META-INF" . PATH_SEP . "translations.env";
|
||||
file_exists($this->translationEnv) ? unlink($this->translationEnv) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the unit tests.
|
||||
* Get base uri for rest applications.
|
||||
* @return string
|
||||
*/
|
||||
protected function tearDown()
|
||||
private function getBaseUri()
|
||||
{
|
||||
$this->dropDB();
|
||||
$_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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,9 +62,11 @@ class LanguageTest extends \WorkflowTestCase
|
||||
public function testGetLanguageList()
|
||||
{
|
||||
$list = $this->object->getLanguageList();
|
||||
$this->assertCount(1, $list);
|
||||
$this->assertEquals('en', $list[0]['LANG_ID']);
|
||||
$this->assertEquals('English', $list[0]['LANG_NAME']);
|
||||
$expected = [
|
||||
'LANG_ID' => 'en',
|
||||
'LANG_NAME' => 'English',
|
||||
];
|
||||
$this->assertContains($expected, $list);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,16 +77,23 @@ class LanguageTest extends \WorkflowTestCase
|
||||
*/
|
||||
public function testGetLanguageListInstalled()
|
||||
{
|
||||
$this->installLanguage('es', __DIR__.'/processmaker.es.po');
|
||||
$this->installLanguage('es', __DIR__ . '/processmaker.es.po');
|
||||
$list = $this->object->getLanguageList();
|
||||
$this->assertCount(2, $list);
|
||||
$this->assertEquals('en', $list[0]['LANG_ID']);
|
||||
$this->assertEquals('English', $list[0]['LANG_NAME']);
|
||||
$this->assertEquals('es-ES', $list[1]['LANG_ID']);
|
||||
$this->assertEquals('Spanish (Spain)', $list[1]['LANG_NAME']);
|
||||
$this->uninstallLanguage('es', __DIR__.'/processmaker.es.po');
|
||||
$english = [
|
||||
'LANG_ID' => 'en',
|
||||
'LANG_NAME' => 'English',
|
||||
];
|
||||
$this->assertContains($english, $list);
|
||||
|
||||
$spanish = [
|
||||
'LANG_ID' => 'es-ES',
|
||||
'LANG_NAME' => 'Spanish (Spain)',
|
||||
];
|
||||
$this->assertContains($spanish, $list);
|
||||
|
||||
$this->uninstallLanguage('es', __DIR__ . '/processmaker.es.po');
|
||||
$list2 = $this->object->getLanguageList();
|
||||
$this->assertCount(1, $list2);
|
||||
$this->assertContains($english, $list2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +104,7 @@ class LanguageTest extends \WorkflowTestCase
|
||||
*/
|
||||
private function installLanguage($lanId, $filename)
|
||||
{
|
||||
copy($filename, PATH_CORE.'content/translations/'.basename($filename));
|
||||
copy($filename, PATH_CORE . 'content/translations/' . basename($filename));
|
||||
$language = \LanguagePeer::retrieveByPK($lanId);
|
||||
$language->setLanEnabled(1);
|
||||
$language->save();
|
||||
@@ -89,7 +119,7 @@ class LanguageTest extends \WorkflowTestCase
|
||||
*/
|
||||
private function uninstallLanguage($lanId, $filename)
|
||||
{
|
||||
unlink(PATH_CORE.'content/translations/'.basename($filename));
|
||||
unlink(PATH_CORE . 'content/translations/' . basename($filename));
|
||||
$language = \LanguagePeer::retrieveByPK($lanId);
|
||||
$language->setLanEnabled(0);
|
||||
$language->save();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user