Arreglo de conflictos
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
<project name="ProcessMaker Michelangelo" default="build-phpcs">
|
||||
<target name="build"
|
||||
depends="prepare,lint,phploc,pdepend,phpcs-ci,phpdox, behat"/>
|
||||
depends="prepare,lint,phploc,pdepend,phpcs-ci,phpunit,phpdox,behat"/>
|
||||
|
||||
<target name="build-simple"
|
||||
depends="prepare,phpunit,phpcs-ci,phploc,lint"/>
|
||||
@@ -122,7 +122,12 @@
|
||||
</target>
|
||||
|
||||
<target name="phpunit" description="Run unit tests with PHPUnit">
|
||||
<exec executable="phpunit" failonerror="false"/>
|
||||
<exec executable="phpunit">
|
||||
<arg value="--testsuite" />
|
||||
<arg path="api" />
|
||||
<arg value="--bootstrap" />
|
||||
<arg path="${basedir}/workflow/engine/src/Tests/bootstrap.php" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,48 @@ Requirements:
|
||||
Background:
|
||||
Given that I have a valid access_token
|
||||
|
||||
|
||||
#Listado de casos
|
||||
Scenario: Returns a list of the cases for the logged in user (Inbox)
|
||||
Given I request "cases"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 14 records
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Draft)
|
||||
Given I request "cases/draft"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 15 records
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Participated)
|
||||
Given I request "cases/participated"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 30 records
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Unassigned)
|
||||
Given I request "cases/unassigned"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 12 records
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Paused)
|
||||
Given I request "cases/paused"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "array"
|
||||
And the response has 12 records
|
||||
|
||||
|
||||
Scenario: Returns information about a given case of the list Inbox
|
||||
Given I request "cases/48177942153275bfa28bd04070312685"
|
||||
Then the response status code should be 200
|
||||
|
||||
@@ -26,5 +26,4 @@ Scenario: Create a new case note for specified case
|
||||
Then the response status code should be 201
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "object"
|
||||
|
||||
And the type is "object"
|
||||
@@ -1,4 +1,4 @@
|
||||
ProcessMakerMichelangelo @RestAPI
|
||||
@ProcessMakerMichelangelo @RestAPI
|
||||
Feature: Case Note Negative Tests
|
||||
Requirements:
|
||||
a workspace with three cases of the process "Test Users-Step-Properties End Point"
|
||||
|
||||
@@ -46,10 +46,7 @@ Scenario: Returns the variables can be system variables and/or case variables.
|
||||
And the "date3" property equals "2014-03-03"
|
||||
And the "date4" property equals "2014-03-01"
|
||||
And the "suggest2" property equals "51049032352d56710347233042615067"
|
||||
And the "suggest2_label" property equals "aaron"
|
||||
|
||||
|
||||
|
||||
And the "suggest2_label" property equals "aaron"
|
||||
And the "sample" property in row 1 of property "grid" equals "jose"
|
||||
And the "currency1" property equals "12,334,444.00"
|
||||
And the "percentage1" property equals "333.00 %"
|
||||
|
||||
@@ -38,58 +38,4 @@ Scenario: Sends variables to a case (negative tests)
|
||||
Then the response status code should be 200
|
||||
And the content type is "application/json"
|
||||
And the response charset is "UTF-8"
|
||||
And the type is "object"
|
||||
|
||||
|
||||
|
||||
18130826553359171798e40060879912
|
||||
|
||||
"nameany": "wendy344%",
|
||||
"namealphabetic": "nestor123",
|
||||
"namealphanumeric": "rad1233$%",
|
||||
"nameinteger": "342432,7",
|
||||
"namerealnumber": "35353",
|
||||
"nameemail": "wendycolosacom",
|
||||
"namelogin": "sample",
|
||||
"valorreal": "242343253,253.00",
|
||||
"valorinteger": "346436363",
|
||||
"porcentagereal": "64600",
|
||||
"porcentageinteger": "464",
|
||||
"observaciones": "ninguna",
|
||||
"areascolosa": "sample",
|
||||
"areascolosa_label": "sample",
|
||||
"COUNTRY": "BOA",
|
||||
"COUNTRY_label": "Bolivia",
|
||||
"STATE": "aH",
|
||||
"STATE_label": "Chuquisaca",
|
||||
"LOCATION": "SRE",
|
||||
"LOCATION_label": "Sucre",
|
||||
"aprobado": "20",
|
||||
"aprobadohint": "0",
|
||||
"checkbox1": "sample",
|
||||
"checkbox2": "oki",
|
||||
"checkbox3": "Off",
|
||||
"radiogroup1": "hola",
|
||||
"radiogroup1_label": "Primero",
|
||||
"date1": "hola",
|
||||
"date2": "2013-11-08",
|
||||
"date3": "2014-03-09",
|
||||
"date4": "2014-03-02",
|
||||
"suggest2": "51049032352d56710347233042615067",
|
||||
"suggest2_label": "sample",
|
||||
"grid": {
|
||||
"1": {
|
||||
"sample": "hugo",
|
||||
"currency1": "2,424,234.00",
|
||||
"percentage1": "354.00 %",
|
||||
"suggest1_label": "dorothy",
|
||||
"suggest1": "81205219852d56719a97fc3086456770",
|
||||
"textarea1": "ninguno",
|
||||
"dropdown1": "uno",
|
||||
"yesno1": "0",
|
||||
"checkbox1": "On",
|
||||
"date1": "2014-03-20",
|
||||
"link1": "http://www.google.com/",
|
||||
"link1_label": "link1",
|
||||
"file1": "Tuesday.docx",
|
||||
"dropdown1_label": "uno"
|
||||
And the type is "object"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,38 +9,38 @@ Scenario: Returns a list of the cases for the logged in user (Inbox)
|
||||
Given I request "cases"
|
||||
Then the response status code should be 400
|
||||
And the response has 4 records
|
||||
And the response status message should have the following text "<records>"
|
||||
And the response status message should have the following text "Records"
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Draft)
|
||||
Given I request "cases/draft"
|
||||
Then the response status code should be 400
|
||||
And the response has 4 records
|
||||
And the response status message should have the following text "<records>"
|
||||
And the response status message should have the following text "Records"
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Participated)
|
||||
Given I request "cases/participated"
|
||||
Then the response status code should be 400
|
||||
And the response has 4 records
|
||||
And the response status message should have the following text "<records>"
|
||||
And the response status message should have the following text "Records"
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Unassigned)
|
||||
Given I request "cases/unassigned"
|
||||
Then the response status code should be 400
|
||||
And the response has 4 records
|
||||
And the response status message should have the following text "<records>"
|
||||
And the response status message should have the following text "Records"
|
||||
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Paused)
|
||||
Given I request "cases/paused"
|
||||
Then the response status code should be 400
|
||||
And the response has 4 records
|
||||
And the response status message should have the following text "<records>"
|
||||
And the response status message should have the following text "Records"
|
||||
|
||||
Scenario: Returns a list of the cases for the logged in user (Advanced Search)
|
||||
Given I request "cases/advanced-search"
|
||||
Then the response status code should be 400
|
||||
And the response has 4 records
|
||||
And the response status message should have the following text "<records>"
|
||||
And the response status message should have the following text "Records"
|
||||
@@ -41,7 +41,7 @@ Scenario: Generate or regenerates an output documents for a given case
|
||||
|
||||
Scenario: Delete an uploaded or generated document from a case.
|
||||
And that I want to delete a resource with the key "app_doc_uid_0" stored in session array
|
||||
Gie I request "output-document"
|
||||
Given I request "output-document"
|
||||
Then the response status code should be 200
|
||||
And the content type is "application/json"
|
||||
And the response charset is "UTF-8"
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
@ProcessMakerMichelangelo @RestAPI
|
||||
Feature: Output Documents cases Main Tests
|
||||
Requirements:
|
||||
a workspace with one case of the process "Test Output Document Case"
|
||||
and there are six Output Documents in the process
|
||||
|
||||
Background:
|
||||
Given that I have a valid access_token
|
||||
|
||||
Scenario Outline: Pull information of an inexistent input document. should return an error
|
||||
Given I request "cases/64654381053382b8bb4c415067063003/input-document/<input-document>"
|
||||
Then the response status code should be 200
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<?php
|
||||
namespace Maveriks;
|
||||
|
||||
use ProcessMaker\Services\Api;
|
||||
use Maveriks\Util;
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\Services;
|
||||
|
||||
class WebApplication
|
||||
{
|
||||
protected $rootDir = "";
|
||||
protected $workflowDir = "";
|
||||
protected $workspaceDir = "";
|
||||
protected $workspaceCacheDir = "";
|
||||
protected $requestUri = "";
|
||||
protected $responseMultipart = array();
|
||||
|
||||
@@ -86,7 +87,7 @@ class WebApplication
|
||||
} else {
|
||||
$this->dispatchApiRequest($request["uri"], $request["version"]);
|
||||
}
|
||||
Util\Logger::log("API::End Dispatching ".$_SERVER["REQUEST_METHOD"]." ".$request["uri"]);
|
||||
Util\Logger::log("API::End Dispatch");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -105,19 +106,10 @@ class WebApplication
|
||||
public function multipart($uri, $version = "1.0")
|
||||
{
|
||||
$stringInput = file_get_contents('php://input');
|
||||
if (empty($stringInput)) {
|
||||
$rest = new \Maveriks\Extension\Restler();
|
||||
$rest->setMessage(new RestException(Api::STAT_APP_EXCEPTION, "Invalid Request, multipart without body."));
|
||||
exit();
|
||||
} else {
|
||||
$input = json_decode($stringInput);
|
||||
if (empty($input->calls)) {
|
||||
$rest = new \Maveriks\Extension\Restler();
|
||||
$rest->setMessage(new RestException(Api::STAT_APP_EXCEPTION, "Invalid Request, multipart body without calls."));
|
||||
exit();
|
||||
}
|
||||
if (is_null($stringInput)) {
|
||||
return array(); //no body
|
||||
}
|
||||
|
||||
$input = json_decode($stringInput);
|
||||
|
||||
$baseUrl = (empty($input->base_url)) ? $uri : $input->base_url;
|
||||
foreach($input->calls as $value) {
|
||||
@@ -152,6 +144,8 @@ class WebApplication
|
||||
*/
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
|
||||
require_once $this->rootDir . "framework/src/Maveriks/Extension/Restler/UploadFormat.php";
|
||||
|
||||
// $servicesDir contains directory where Services Classes are allocated
|
||||
$servicesDir = $this->workflowDir . 'engine' . DS . 'src' . DS . 'ProcessMaker' . DS . 'Services' . DS;
|
||||
// $apiDir - contains directory to scan classes and add them to Restler
|
||||
@@ -166,15 +160,27 @@ class WebApplication
|
||||
/*
|
||||
* Load Api ini file for Rest Service
|
||||
*/
|
||||
$apiIniConf = array();
|
||||
$config = array();
|
||||
|
||||
if (file_exists($apiIniFile)) {
|
||||
$apiIniConf = Util\Common::parseIniFile($apiIniFile);
|
||||
$cachedConfig = $this->workspaceCacheDir . "api-config.php";
|
||||
|
||||
// verify if config cache file exists, is array and the last modification date is the same when cache was created.
|
||||
if (! file_exists($cachedConfig) || ! is_array($config = include($cachedConfig)) || $config["_chk"] != filemtime($apiIniFile)) {
|
||||
$config = Util\Common::parseIniFile($apiIniFile);
|
||||
$config["_chk"] = filemtime($apiIniFile);
|
||||
if (! is_dir(dirname($cachedConfig))) {
|
||||
Util\Common::mk_dir(dirname($cachedConfig));
|
||||
}
|
||||
file_put_contents($cachedConfig, "<?php return " . var_export($config, true).";");
|
||||
Util\Logger::log("Configuration cache was loaded and cached to: $cachedConfig");
|
||||
} else {
|
||||
Util\Logger::log("Loading Api Configuration from: $cachedConfig");
|
||||
}
|
||||
}
|
||||
|
||||
// Setting current workspace to Api class
|
||||
\ProcessMaker\Services\Api::setWorkspace(SYS_SYS);
|
||||
// TODO remove this setting on the future, it is not needed, but if it is not present is throwing a warning
|
||||
//\Luracast\Restler\Format\HtmlFormat::$viewPath = $servicesDir . 'oauth2/views';
|
||||
Services\Api::setWorkspace(SYS_SYS);
|
||||
|
||||
// create a new Restler instance
|
||||
//$rest = new \Luracast\Restler\Restler();
|
||||
@@ -190,20 +196,13 @@ class WebApplication
|
||||
// Setting database connection source
|
||||
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
|
||||
$port = empty($port) ? '' : ";port=$port";
|
||||
\ProcessMaker\Services\OAuth2\Server::setDatabaseSource(DB_USER, DB_PASS, DB_ADAPTER.":host=$host;dbname=".DB_NAME.$port);
|
||||
Services\OAuth2\Server::setDatabaseSource(DB_USER, DB_PASS, DB_ADAPTER.":host=$host;dbname=".DB_NAME.$port);
|
||||
|
||||
// Setting default OAuth Client id, for local PM Web Designer
|
||||
\ProcessMaker\Services\OAuth2\Server::setPmClientId($pmOauthClientId);
|
||||
Services\OAuth2\Server::setPmClientId($pmOauthClientId);
|
||||
|
||||
require_once $this->workflowDir . "engine/src/Extension/Restler/UploadFormat.php";
|
||||
//require_once PATH_CORE
|
||||
|
||||
//$rest->setSupportedFormats('JsonFormat', 'XmlFormat', 'UploadFormat');
|
||||
//$rest->setOverridingFormats('UploadFormat', 'JsonFormat', 'XmlFormat', 'HtmlFormat');
|
||||
$rest->setOverridingFormats('JsonFormat', 'UploadFormat');
|
||||
|
||||
// Override $_SERVER['REQUEST_URI'] to Restler handles the current url correctly
|
||||
|
||||
$isPluginRequest = strpos($uri, '/plugin-') !== false ? true : false;
|
||||
|
||||
if ($isPluginRequest) {
|
||||
@@ -215,6 +214,7 @@ class WebApplication
|
||||
$uri = str_replace('/plugin-'.$pluginName, '', $uri);
|
||||
}
|
||||
|
||||
// Override $_SERVER['REQUEST_URI'] to Restler handles the modified url
|
||||
$_SERVER['REQUEST_URI'] = $uri;
|
||||
|
||||
if (! $isPluginRequest) { // if it is not a request for a plugin endpoint
|
||||
@@ -224,19 +224,17 @@ class WebApplication
|
||||
foreach ($classesList as $classFile) {
|
||||
if (pathinfo($classFile, PATHINFO_EXTENSION) === 'php') {
|
||||
$namespace = '\\ProcessMaker\\Services\\' . str_replace(
|
||||
DIRECTORY_SEPARATOR,
|
||||
'\\',
|
||||
str_replace('.php', '', str_replace($servicesDir, '', $classFile))
|
||||
);
|
||||
//var_dump($namespace); die;
|
||||
DIRECTORY_SEPARATOR,
|
||||
'\\',
|
||||
str_replace('.php', '', str_replace($servicesDir, '', $classFile))
|
||||
);
|
||||
$rest->addAPIClass($namespace);
|
||||
}
|
||||
}
|
||||
|
||||
// adding aliases for Restler
|
||||
//print_r($apiIniConf);
|
||||
if (array_key_exists('alias', $apiIniConf)) {
|
||||
foreach ($apiIniConf['alias'] as $alias => $aliasData) {
|
||||
if (array_key_exists('alias', $config)) {
|
||||
foreach ($config['alias'] as $alias => $aliasData) {
|
||||
if (is_array($aliasData)) {
|
||||
foreach ($aliasData as $label => $namespace) {
|
||||
$namespace = '\\' . ltrim($namespace, '\\');
|
||||
@@ -391,7 +389,10 @@ class WebApplication
|
||||
require_once (PATH_DB . SYS_SYS . "/db.php");
|
||||
|
||||
// defining constant for workspace shared directory
|
||||
define("PATH_WORKSPACE", PATH_DB . SYS_SYS . PATH_SEP);
|
||||
$this->workspaceDir = PATH_DB . SYS_SYS . PATH_SEP;
|
||||
$this->workspaceCacheDir = PATH_DB . SYS_SYS . PATH_SEP . "cache" . PATH_SEP;
|
||||
|
||||
define("PATH_WORKSPACE", $this->workspaceDir);
|
||||
// including workspace shared classes -> particularlly for pmTables
|
||||
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . PATH_WORKSPACE);
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
<directory>./tests/unit/</directory>
|
||||
</testsuite>
|
||||
-->
|
||||
<testsuite name="api">
|
||||
<directory>./workflow/engine/src/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<!-- <filter>
|
||||
|
||||
@@ -261,7 +261,9 @@ class ProcessCategory
|
||||
}
|
||||
//Return
|
||||
if ($oProcessCategory != '') {
|
||||
return $oProcessCategory;
|
||||
$oProcessCategory = array_change_key_case($oProcessCategory, CASE_LOWER);
|
||||
$oResponse = json_decode(json_encode($oProcessCategory), false);
|
||||
return $oResponse;
|
||||
} else {
|
||||
throw (new \Exception( 'The Category with cat_uid: '.$cat_uid.' doesn\'t exist!'));
|
||||
}
|
||||
@@ -291,7 +293,7 @@ class ProcessCategory
|
||||
$pcat->setCategoryUid( $catUid );
|
||||
$pcat->setCategoryName( $catName );
|
||||
$pcat->save();
|
||||
$oProcessCategory = array_change_key_case($this->getCategory( $catUid ), CASE_LOWER);
|
||||
$oProcessCategory = $this->getCategory( $catUid );
|
||||
//Return
|
||||
return $oProcessCategory;
|
||||
} catch (\Exception $e) {
|
||||
@@ -321,9 +323,10 @@ class ProcessCategory
|
||||
$pcat->setCategoryUid( $catUID );
|
||||
$pcat->setCategoryName( $catName );
|
||||
$pcat->save();
|
||||
$oProcessCategory = array_change_key_case($this->getCategory( $cat_uid ), CASE_LOWER);
|
||||
$oProcessCategory = $this->getCategory( $cat_uid );
|
||||
//Return
|
||||
return $oProcessCategory;
|
||||
$oResponse = json_decode(json_encode($oProcessCategory), false);
|
||||
return $oResponse;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
|
||||
@@ -8,11 +8,25 @@ if (!class_exists("Propel")) {
|
||||
/**
|
||||
* Class ProcessCategoryTest
|
||||
*
|
||||
* @package Tests\BusinessModel
|
||||
* @package Tests/ProcessMaker/BusinessModel
|
||||
*/
|
||||
class ProcessCategoryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $arrayUid = array();
|
||||
protected $oCategory;
|
||||
|
||||
/**
|
||||
* Set class for test
|
||||
*
|
||||
* @coversNothing
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->oCategory = new \ProcessMaker\BusinessModel\ProcessCategory();
|
||||
}
|
||||
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
@@ -26,6 +40,67 @@ class ProcessCategoryTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add Category
|
||||
*
|
||||
* @covers \BusinessModel\ProcessCategory::addCategory
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testAddCategory()
|
||||
{
|
||||
$response = $this->oCategory->addCategory('New Category Test');
|
||||
$this->assertTrue(is_object($response));
|
||||
$aResponse = json_decode(json_encode($response), true);
|
||||
return $aResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test put Category
|
||||
*
|
||||
* @covers \BusinessModel\ProcessCategory::updateCategory
|
||||
* @depends testAddCategory
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testUpdateCategory(array $aResponse)
|
||||
{
|
||||
$response = $this->oCategory->updateCategory($aResponse["cat_uid"], 'Name Update Category Test');
|
||||
$this->assertTrue(is_object($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get Category
|
||||
*
|
||||
* @covers \BusinessModel\ProcessCategory::getCategory
|
||||
* @depends testAddCategory
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testGetCategory(array $aResponse)
|
||||
{
|
||||
$response = $this->oCategory->getCategory($aResponse["cat_uid"]);
|
||||
$this->assertTrue(is_object($response));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test delete Category
|
||||
*
|
||||
* @covers \BusinessModel\ProcessCategory::deleteCategory
|
||||
* @depends testAddCategory
|
||||
* @param array $aResponse
|
||||
*
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function testDeleteCategory(array $aResponse)
|
||||
{
|
||||
$response = $this->oCategory->deleteCategory($aResponse["cat_uid"]);
|
||||
$this->assertTrue(empty($response));
|
||||
}
|
||||
|
||||
public function testCreate()
|
||||
{
|
||||
try {
|
||||
@@ -46,6 +121,7 @@ class ProcessCategoryTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotEmpty($processCategoryUid);
|
||||
}
|
||||
|
||||
|
||||
public function testGetCategories()
|
||||
{
|
||||
$processCategory = new \ProcessMaker\BusinessModel\ProcessCategory();
|
||||
|
||||
Reference in New Issue
Block a user