Merged in paulis/processmaker/HOR-1088 (pull request #4344)

HOR-1088
This commit is contained in:
Julio Cesar Laura Avendaño
2016-06-03 10:11:43 -04:00
31 changed files with 0 additions and 4917 deletions

View File

@@ -82,7 +82,6 @@ class Bootstrap
self::registerClass("G_Error", PATH_GULLIVER . "class.error.php");
self::registerClass("filterForm", PATH_GULLIVER . "class.filterForm.php");
self::registerClass("Form", PATH_GULLIVER . "class.form.php");
self::registerClass("functionTest", PATH_GULLIVER . "class.functionTest.php");
self::registerClass("G", PATH_GULLIVER . "class.g.php");
self::registerClass("headPublisher", PATH_GULLIVER . "class.headPublisher.php");
self::registerClass("Helper", PATH_GULLIVER . "class.helper.php");
@@ -107,9 +106,7 @@ class Bootstrap
self::registerClass("Table", PATH_GULLIVER . "class.table.php");
self::registerClass("TemplatePowerParser", PATH_GULLIVER . "class.templatePower.php");
self::registerClass("TemplatePower", PATH_GULLIVER . "class.templatePower.php");
self::registerClass("testTools", PATH_GULLIVER . "class.testTools.php");
self::registerClass("Tree", PATH_GULLIVER . "class.tree.php");
self::registerClass("unitTest", PATH_GULLIVER . "class.unitTest.php");
self::registerClass("WebResource", PATH_GULLIVER . "class.webResource.php");
self::registerClass("XmlForm_Field_WYSIWYG_EDITOR", PATH_GULLIVER . "class.wysiwygEditor.php");
self::registerClass("Xml_Node", PATH_GULLIVER . "class.xmlDocument.php");
@@ -162,8 +159,6 @@ class Bootstrap
self::registerClass("XmlForm_Field_DVEditor", PATH_GULLIVER . "class.xmlformExtension.php");
self::registerClass("XmlForm_Field_FastSearch", PATH_GULLIVER . "class.xmlformExtension.php");
self::registerClass("xmlformTemplate", PATH_GULLIVER . "class.xmlformTemplate.php");
self::registerClass("ymlDomain", PATH_GULLIVER . "class.ymlDomain.php");
self::registerClass("ymlTestCases", PATH_GULLIVER . "class.ymlTestCases.php");
// ProcessMaker classes
self::registerClass("InvalidIndexSearchTextException", PATH_CLASSES . "class.AppSolr.php");

View File

@@ -1,68 +0,0 @@
<?php
/**
* class.functionTest.php
*
* @package gulliver.system
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
*
* @package gulliver.system
*
*/
class functionTest
{
public $dbc;
public $times;
/**
* Starts functionTest with a database connection
*
* @access public
* @param string $dbc
* @return void
*
*/
public function functionTest ($dbc)
{
$this->dbc = $dbc;
}
/**
* this function is a sample
*
* @access public
* @param string $testCase
* @param string $testDomain
* @param string $limeTestObject
* @return ok
*
*/
public function sample ($testCase, &$testDomain, &$limeTestObject)
{
return "OK";
}
}

View File

@@ -1,199 +0,0 @@
<?php
/**
* class.testTools.php
*
* @package gulliver.system
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
*
* @package gulliver.system
*
*/
G::LoadSystem( 'ymlDomain' );
G::LoadSystem( 'ymlTestCases' );
G::LoadSystem( 'unitTest' );
class testTools
{
/**
* importDB
*
* @param string $host
* @param string $user
* @param string $password
* @param string $database
* @param string $importFile
*
* @return none
*/
function importDB ($host, $user, $password, $database, $importFile)
{
exec( "mysql -h " . $host . " --user=" . $user . " --password=" . $password . " $database < $importFile" );
}
/**
* importLocalDB
*
* @param string $importFile
*
* @return none
*/
function importLocalDB ($importFile)
{
self::importDB( DB_HOST, DB_USER, DB_PASS, DB_NAME, $importFile );
}
/**
* callMethod
*
* @param string $methodFile
* @param string $GET
* @param string $POST
* @param string $SESSION
*
* @return none
*/
function callMethod ($methodFile, $GET, $POST, $SESSION)
{
//TODO $_SERVER
self::arrayDelete( $_GET );
self::arrayDelete( $_POST );
self::arrayDelete( $_SESSION );
self::arrayAppend( $_GET, $GET );
self::arrayAppend( $_POST, $POST );
self::arrayAppend( $_SESSION, $SESSION );
include (PATH_CORE . 'methods/' . $methodFile);
}
/**
* arrayAppend
*
* @param string &$to
* @param string $appendFrom
*
* @return boolean true
*/
function arrayAppend (&$to, $appendFrom)
{
foreach ($appendFrom as $appendItem) {
$to[] = $appendItem;
}
return true;
}
/**
* arrayDelete
*
* @param array &$array
*
* @return boolean true
*/
function arrayDelete (&$array)
{
foreach ($array as $key => $value) {
unset( $array[$key] );
}
return true;
}
/**
* replaceVariables
*
* @param string $Fields
* @param array $ExternalVariables
*
* @return array $Fields
*/
//@@
function replaceVariables ($Fields, $ExternalVariables = array())
{
//TODO: Verify dependencies between fields
foreach ($Fields as $key => $field) {
if (is_string( $field )) {
$mergedValues = G::array_merges( $Fields, $ExternalVariables );
$Fields[$key] = G::ReplaceDataField( $field, $mergedValues );
}
}
return $Fields;
}
// EXTRA TOOLS
/**
* findValue
*
* @param string $value
* @param object &$obj
*
* @return (boolean | string) ((true | false) | $value)
*/
function findValue ($value, &$obj)
{
if (is_array( $obj )) {
foreach ($obj as $key => $val) {
if ($res = self::findValue( $value, $obj[$key] )) {
if ($res == true) {
return $key;
} else {
return $key . '.' . $res;
}
}
}
return false;
} elseif (is_object( $obj )) {
foreach ($obj as $key => $val) {
if ($res = self::findValue( $value, $obj->$key )) {
if ($res == true) {
return $key;
} else {
return $key . '.' . $res;
}
}
}
return false;
} else {
return $obj == $value;
}
}
}
/* Some extra global functions */
/**
* domain
*
* @param string $location *
* @return object $result
*/
function domain ($location)
{
global $testDomain;
$result = $testDomain->get( $location );
if (count( $result ) == 0) {
trigger_error( "'$location' is an empty domain.", E_USER_WARNING );
}
return $result;
}

View File

@@ -1,79 +0,0 @@
<?php
/**
* class.unitTest.php
*
* @package gulliver.system
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
*
* @package gulliver.system
*/
class unitTest
{
var $dbc;
var $times;
var $yml;
var $domain;
var $testLime;
function unitTest ($ymlFile, &$testLime, &$testDomain)
{
if (! isset( $testDomain )) {
$testDomain = new ymlDomain();
}
$this->domain = & $testDomain;
$this->testLime = & $testLime;
$this->yml = new ymlTestCases( $ymlFile, $this->domain, $this->testLime );
}
//Load a Test (group of unitary tests) defined in the Yml file.
function load ($testName, $fields = array())
{
$this->yml->load( $testName, $fields );
}
//Run one single unit test from the loaded Test
function runSingle ($fields = array())
{
return $this->yml->runSingle( $this, $fields );
}
//Run a group of unit tests from the loaded Test
function runMultiple ($fields = array(), $count = -1, $start = 0)
{
return $this->yml->runMultiple( $this, $fields, $count, $start );
}
//Run all the unit tests from the loaded Test
function runAll ($fields = array())
{
return $this->yml->runMultiple( $this, $fields, - 1, 0 );
}
//A sample of "Function" to run a unit test.
function sampleTestFunction ($testCase, &$Fields)
{
$result = ($Fields['APP_UID'] != '') ? "OK" : "FALSE";
return $result;
}
}

View File

@@ -1,296 +0,0 @@
<?php
/**
* class.ymlDomain.php
*
* @package gulliver.system
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
*
* @package gulliver.system
*
*/
require_once (PATH_THIRDPARTY . 'lime/yaml.class.php');
/**
* ymlDomain class
*
* @copyright (C) 2002 by Colosa Development Team.
* @package gulliver.system
*/
class ymlDomain
{
public $global;
/**
* function ymlDomain
*
* @access public
* @return void
*/
public function ymlDomain ()
{
$this->global = sfYAML::Load( PATH_FIXTURES . 'domain.yml' );
}
/**
* function addDomain
*
* @access public
* @param string $domainName
* @return boolean
*/
public function addDomain ($domainName)
{
$keys = $this->name2keys( $domainName );
$currDomain = & $this->global;
$i = 0;
for ($i = 0; $i < count( $keys ); $i ++) {
if (is_array( $currDomain )) {
if (! isset( $currDomain[$keys[$i]] )) {
$currDomain[$keys[$i]] = array ();
}
$currDomain = & $currDomain[$keys[$i]];
} else {
trigger_error( "Operation not possible: Subdomain is not present $domainName", E_USER_ERROR );
return false;
}
}
return true;
}
/**
* function addDomainValue
*
* @access public
* @param string $domainName
* @param string $value
* @return boolean
*/
public function addDomainValue ($domainName, $value)
{
$keys = $this->name2keys( $domainName );
$currDomain = & $this->global;
$i = 0;
for ($i = 0; $i < count( $keys ); $i ++) {
if (is_array( $currDomain )) {
$currDomain = & $currDomain[$keys[$i]];
} else {
trigger_error( "Operation not possible: Subdomain is not present $domainName", E_USER_ERROR );
return false;
}
}
$currDomain[] = $value;
return true;
}
/**
* function exists
*
* @access public
* @param string $domainName
* @return boolean
*/
public function exists ($domainName)
{
$keys = $this->name2keys( $domainName );
$currDomain = & $this->global;
$i = 0;
for ($i = 0; $i < count( $keys ); $i ++) {
if (is_array( $currDomain ) && isset( $currDomain[$keys[$i]] )) {
$currDomain = & $currDomain[$keys[$i]];
} else {
return false;
}
}
return true;
}
/**
* function get
*
* @access public
* @param string $resource
* @return array
*/
public function get ($resource)
{
if (is_array( $result = $this->load( $resource ) )) {
//Get one value per each $item
//Ex. *.first.name.es => Returns an array with all of the defined firstNames.
// first.name.es => Returns an array with one firstName.
// *.name.es => Returns an array with one value per each sub domain of name.es.
// For example: if name.es has the subdomains:
// first.name.es and last.name.es, it returns an array of
// two elements: one firstName and one lastName.
foreach ($result as $key => $item) {
if (is_array( $item )) {
$subResult = $this->plainArray( $item );
$result[$key] = $subResult[array_rand( $subResult, 1 )];
}
}
return $result;
} else {
return array ('');
}
}
/**
* function name2keys
*
* @access public
* @param string $resource
* @return array
*/
public function name2keys ($resource)
{
if (strpos( $resource, '.' ) !== false) {
$revKeys = explode( '.', $resource );
$keys = array ();
for ($i = count( $revKeys ) - 1; $i >= 0; $i --) {
$keys[] = $revKeys[$i];
}
} elseif (strpos( $resource, '/' ) !== false) {
$rootKeys = explode( '/', $resource );
unset( $rootKeys[0] );
$keys = array_values( $rootKeys );
} else {
$keys = array ($resource );
}
return $keys;
}
/**
* function load
*
* @access public
* @param string $resource
* @return array
*/
public function load ($resource)
{
$keys = $this->name2keys( $resource );
//Find in global variable
if (count( $this->getNode( $keys[0], $this->global ) ) > 0) {
return $this->find( $keys, $this->global );
} else {
if (file_exists( PATH_FIXTURES . $keys[0] . '.yml' )) {
$local = sfYAML::Load( PATH_FIXTURES . $keys[0] . '.yml' );
unset( $keys[0] );
$keys = array_values( $keys );
return $this->find( $keys, $local );
} else {
return null;
}
}
return null;
}
/**
* function find
*
* @access public
* @param string $nodesKey
* @param string $where
* @return array
*/
public function find ($nodesKey, $where)
{
if (count( $nodesKey ) == 1) {
return $this->getNode( $nodesKey[0], $where );
} elseif (count( $nodesKey ) > 1) {
$routes = $this->getNode( $nodesKey[0], $where );
$result = array ();
unset( $nodesKey[0] );
$nodesKey = array_values( $nodesKey );
foreach ($routes as $route) {
if (is_array( $route )) {
$subResult = $this->find( $nodesKey, $route );
$this->arrayAppend( $result, $subResult );
} else {
$result[] = $route;
}
}
return $result;
} else {
return array ();
}
}
/**
* function getNode
*
* @access public
* @param string $nodesKey
* @param string $from
* @return array
*/
public function getNode ($nodeKey, $from)
{
if ($nodeKey === '*') {
return array_values( $from );
} elseif (array_key_exists( $nodeKey, $from )) {
return array ($from[$nodeKey] );
} else {
return array ();
}
}
/**
* function plainArray
*
* @access public
* @param array $array
* @return array
*/
public function plainArray ($array)
{
$result = array ();
foreach ($array as $item) {
if (is_array( $item )) {
$appResult = $this->plainArray( $item );
$this->arrayAppend( $result, $appResult );
} else {
$result[] = $item;
}
}
return $result;
}
/**
* function arrayAppend
*
* @access public
* @param string $to
* @param string $appendFrom
* @return void
*/
public function arrayAppend (&$to, $appendFrom)
{
foreach ($appendFrom as $appendItem) {
$to[] = $appendItem;
}
}
}

View File

@@ -1,275 +0,0 @@
<?php
/**
* class.ymlTestCases.php
*
* @package gulliver.system
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/* Dependencies: class.ymlDomain.php; class.testTools.php
* +----------------------------+
* | STRUCTURE for ymlTestFile. |
* +----------------------------+
* TestCasesGroup1:
* - Un caso de prueba.
* Input:
* FIELD_A: "Value_Field_A"
* FIELD_B[]: "Domain_Field_A"
* Output:
* Type: "TypeOfResult" Type of data that should be the result.
* Value: "a:0{}" This node must contain a value that will be serialized compared with the test result.
* - Another test case.
* ...
* TestCasesGroup2:
* ...
*/
/**
*
* @package gulliver.system
*/
class ymlTestCases
{
public $testCaseFile;
public $testCases = array ();
/**
* function TestCases
*
* @access public
* @param string $testCaseFile
* @param string $testDomain
* @param string $testLime
* @return void
*/
public function ymlTestCases ($testCaseFile, &$testDomain, &$testLime)
{
$this->testDomain = & $testDomain;
$this->testLime = & $testLime;
if (basename( $testCaseFile ) === $testCaseFile) {
$testCaseFile = PATH_FIXTURES . $testCaseFile;
}
$this->testCaseFile = $testCaseFile;
}
/**
* function load
*
* @access public
* @param string $inputTestCasesIndex
* @param array $fields
* @return array
*/
public function load ($inputTestCasesIndex = 'TestCases', $fields = array())
{
$testCases = array ();
$input = sfYAML::Load( /*PATH_FIXTURES .*/ $this->testCaseFile );
foreach ($input[$inputTestCasesIndex] as $preTestCase) {
$testFunctionInputs = array ();
foreach ($preTestCase['Input'] as $inputArgument => $value) {
if (substr( $inputArgument, - 2, 2 ) === '[]') {
//DOMAIN
$inputArgument = substr( $inputArgument, 0, strlen( $inputArgument ) - 2 );
if (! isset( $testFunctionInputs[$inputArgument] )) {
$testFunctionInputs[$inputArgument] = array ();
}
//var_dump($this->testDomain->global,$this->testDomain->get( $value ), $value );
ymlDomain::arrayAppend( $testFunctionInputs[$inputArgument], $this->testDomain->get( $value ) );
} else {
//SPECIFIC VALUE
if (! isset( $testFunctionInputs[$inputArgument] )) {
$testFunctionInputs[$inputArgument] = array ();
}
ymlDomain::arrayAppend( $testFunctionInputs[$inputArgument], array ($value) );
}
}
/* Start Block: "Explode" all the posible test cases defined in the yml
* using domains and single values
*/
//Initialize $index key values for the first test case (5.2 array_fill_keys(array_keys($testFunctionInputs),0))
$index = array_combine( array_keys( $testFunctionInputs ), array_fill( 0, count( $testFunctionInputs ), 0 ) );
//array_product()
$prod = 1;
foreach ($testFunctionInputs as $values) {
$prod *= count( $values );
}
$lastCase = ($prod == 0);
while (! $lastCase) {
//foreach($index as $v) echo($v);echo("\n");
/* Put in $aux one test case */
$aux = array ();
foreach ($testFunctionInputs as $key => $values) {
$aux[$key] = $values[$index[$key]];
}
/* CREATE TEST CASE: Put $aux test case in $testCases array */
$i = count( $testCases );
$testCases[$i] = $preTestCase;
$testCases[$i]['Input'] = $aux;
/* Increse the $index key values to the next test case */
$lastCase = true;
foreach ($testFunctionInputs as $key => $values) {
$index[$key] ++;
if ($index[$key] >= count( $values )) {
$index[$key] = 0;
} else {
$lastCase = false;
break;
}
}
}
/*End Block */
}
/* Start Block: Replace @@ tags variables */
foreach ($testCases as $key => $testCase) {
$testCases[$key] = testTools::replaceVariables( $testCases[$key] );
$testCases[$key]['Input'] = testTools::replaceVariables( $testCases[$key]['Input'], $fields );
if (isset( $testCase['Output'] )) {
if (isset( $testCase['Output']['Value'] )) {
/*$testCases[$key]['Output']['Value'] =
unserialize($testCases[$key]['Output']['Value']);*/
}
}
}
/* End Block */
$this->testCases = $testCases;
return $testCases;
}
/**
* function load
* Increase the number of "planned" tests.
*
* @access public
* @param int $count
* @param int $start
* @return void
*/
public function addToPlan ($count = -1, $start = 0)
{
foreach ($this->testCases as $testCase) {
if (($start == 0) && ($count != 0)) {
if (isset( $testCase['TODO'] )) {
$this->testLime->plan ++;
} else {
if (isset( $testCase['Output'] )) {
if (isset( $testCase['Output']['Type'] ) || isset( $testCase['Output']['Value'] )) {
$this->testLime->plan ++;
}
}
}
} else {
$start --;
if ($count > 0) {
$count --;
}
}
}
}
/**
* function run
*
* @access public
* @param object $testerObject
* @param array $fields
* @param int $count
* @param int $start
* @return array
*/
public function run (&$testerObject, $fields = array(), $count = -1, $start = 0)
{
$results = array ();
//$this->addToPlan( $count, $start );
$functions = get_class_methods( get_class( $testerObject ) );
foreach ($functions as $id => $fn) {
$functions[$id] = strtolower( $fn );
}
foreach ($this->testCases as $index => $testCase) {
if (($start == 0) && ($count != 0)) {
if (isset( $testCase['TODO'] )) {
$this->testLime->todo( $testCase['TODO'] );
} else {
if (isset( $testCase['Function'] )) {
if (array_search( strtolower( $testCase['Function'] ), $functions ) !== false) {
$testCase['Input'] = G::array_merges( $testCase['Input'], $fields );
$result = eval( 'return $testerObject->' . $testCase['Function'] . '($testCase, $testCase["Input"]);' );
$results[] = $result;
/* Start Block: Test the $result */
if (isset( $testCase['Output'] )) {
if (isset( $testCase['Output']['Value'] )) {
//$this->testLime->is( $result, $testCase['Output']['Value'], $testCase['Title'] );
$this->testLime->todo( ($testCase['Output']['Type']) );
$this->testLime->diag( "/processmaker/trunk/gulliver/system/class.ymlTestCases.php at line 204" );
} elseif (isset( $testCase['Output']['Type'] )) {
// $this->testLime->isa_ok( $result, $testCase['Output']['Type'], $testCase['Title'] );
$this->testLime->todo( ($testCase['Output']['Type']) );
$this->testLime->diag( "/processmaker/trunk/gulliver/system/class.ymlTestCases.php at line 204" );
}
}
/* End Block */
} else {
$this->testLime->fail( 'Case #' . $index . ': Test function (Function) is not present in tester object.' );
}
} else {
$this->testLime->fail( 'Case #' . $index . ' doesn\'t have a test function (Function) defined.' );
}
}
} else {
$start --;
if ($count > 0) {
$count --;
}
}
}
return $results;
}
/**
* function runSingle
*
* @access public
* @param object $testerObject
* @param array $fields
* @return array
*/
public function runSingle (&$testerObject, $fields = array())
{
$results = $this->run( $testerObject, $fields, 1, 0 );
return $results[0];
}
/**
* function runMultiple
*
* @access public
* @param object $testerObject
* @param array $fields
* @param int $count
* @param int $start
* @return array
*/
public function runMultiple (&$testerObject, $fields = array(), $count = -1, $start = 0)
{
return $this->run( $testerObject, $fields, $count, $start );
}
}

View File

@@ -1,185 +0,0 @@
<?php
require_once PATH_TRUNK . 'gulliver/thirdparty/smarty/libs/Smarty.class.php';
require_once PATH_TRUNK . 'gulliver/system/class.xmlform.php';
require_once PATH_TRUNK . 'gulliver/system/class.xmlDocument.php';
require_once PATH_TRUNK . 'gulliver/system/class.form.php';
require_once PATH_TRUNK . 'gulliver/system/class.dbconnection.php';
require_once PATH_TRUNK . 'gulliver/thirdparty/propel/Propel.php';
require_once PATH_TRUNK . 'gulliver/thirdparty/creole/Creole.php';
require_once PATH_TRUNK . 'gulliver/thirdparty/pear/PEAR.php';
require_once PATH_TRUNK . 'gulliver/system/class.testTools.php';
/**
* Generated by ProcessMaker Test Unit Generator on 2012-07-12 at 22:32:24.
*/
class classtestToolsTest extends PHPUnit_Framework_TestCase
{
/**
* @var testTools
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new testTools();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* This is the default method to test, if the class still having
* the same number of methods.
*/
public function testNumberOfMethodsInThisClass()
{
$methods = get_class_methods('testTools'); $this->assertTrue( count($methods) == 7);
}
/**
* @covers testTools::importDB
* @todo Implement testimportDB().
*/
public function testimportDB()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('importDB', $methods ), 'exists method importDB' );
$r = new ReflectionMethod('testTools', 'importDB');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'host');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
$this->assertTrue( $params[1]->getName() == 'user');
$this->assertTrue( $params[1]->isArray() == false);
$this->assertTrue( $params[1]->isOptional () == false);
$this->assertTrue( $params[2]->getName() == 'password');
$this->assertTrue( $params[2]->isArray() == false);
$this->assertTrue( $params[2]->isOptional () == false);
$this->assertTrue( $params[3]->getName() == 'database');
$this->assertTrue( $params[3]->isArray() == false);
$this->assertTrue( $params[3]->isOptional () == false);
$this->assertTrue( $params[4]->getName() == 'importFile');
$this->assertTrue( $params[4]->isArray() == false);
$this->assertTrue( $params[4]->isOptional () == false);
}
/**
* @covers testTools::importLocalDB
* @todo Implement testimportLocalDB().
*/
public function testimportLocalDB()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('importLocalDB', $methods ), 'exists method importLocalDB' );
$r = new ReflectionMethod('testTools', 'importLocalDB');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'importFile');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
}
/**
* @covers testTools::callMethod
* @todo Implement testcallMethod().
*/
public function testcallMethod()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('callMethod', $methods ), 'exists method callMethod' );
$r = new ReflectionMethod('testTools', 'callMethod');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'methodFile');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
$this->assertTrue( $params[1]->getName() == 'GET');
$this->assertTrue( $params[1]->isArray() == false);
$this->assertTrue( $params[1]->isOptional () == false);
$this->assertTrue( $params[2]->getName() == 'POST');
$this->assertTrue( $params[2]->isArray() == false);
$this->assertTrue( $params[2]->isOptional () == false);
$this->assertTrue( $params[3]->getName() == 'SESSION');
$this->assertTrue( $params[3]->isArray() == false);
$this->assertTrue( $params[3]->isOptional () == false);
}
/**
* @covers testTools::arrayAppend
* @todo Implement testarrayAppend().
*/
public function testarrayAppend()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('arrayAppend', $methods ), 'exists method arrayAppend' );
$r = new ReflectionMethod('testTools', 'arrayAppend');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'to');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
$this->assertTrue( $params[1]->getName() == 'appendFrom');
$this->assertTrue( $params[1]->isArray() == false);
$this->assertTrue( $params[1]->isOptional () == false);
}
/**
* @covers testTools::arrayDelete
* @todo Implement testarrayDelete().
*/
public function testarrayDelete()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('arrayDelete', $methods ), 'exists method arrayDelete' );
$r = new ReflectionMethod('testTools', 'arrayDelete');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'array');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
}
/**
* @covers testTools::replaceVariables
* @todo Implement testreplaceVariables().
*/
public function testreplaceVariables()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('replaceVariables', $methods ), 'exists method replaceVariables' );
$r = new ReflectionMethod('testTools', 'replaceVariables');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'Fields');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
$this->assertTrue( $params[1]->getName() == 'ExternalVariables');
$this->assertTrue( $params[1]->isArray() == false);
$this->assertTrue( $params[1]->isOptional () == true);
$this->assertTrue( $params[1]->getDefaultValue() == Array());
}
/**
* @covers testTools::findValue
* @todo Implement testfindValue().
*/
public function testfindValue()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('findValue', $methods ), 'exists method findValue' );
$r = new ReflectionMethod('testTools', 'findValue');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'value');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
$this->assertTrue( $params[1]->getName() == 'obj');
$this->assertTrue( $params[1]->isArray() == false);
$this->assertTrue( $params[1]->isOptional () == false);
}
}

View File

@@ -1,223 +0,0 @@
<?php
require_once PATH_TRUNK . 'gulliver/thirdparty/smarty/libs/Smarty.class.php';
require_once PATH_TRUNK . 'gulliver/system/class.xmlform.php';
require_once PATH_TRUNK . 'gulliver/system/class.xmlDocument.php';
require_once PATH_TRUNK . 'gulliver/system/class.form.php';
require_once PATH_TRUNK . 'gulliver/system/class.dbconnection.php';
require_once PATH_TRUNK . 'gulliver/thirdparty/propel/Propel.php';
require_once PATH_TRUNK . 'gulliver/thirdparty/creole/Creole.php';
require_once PATH_TRUNK . 'gulliver/thirdparty/pear/PEAR.php';
require_once PATH_TRUNK . 'gulliver/system/class.ymlDomain.php';
/**
* Generated by ProcessMaker Test Unit Generator on 2012-07-12 at 22:32:24.
*/
class classymlDomainTest extends PHPUnit_Framework_TestCase
{
/**
* @var ymlDomain
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = new ymlDomain();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
/**
* This is the default method to test, if the class still having
* the same number of methods.
*/
public function testNumberOfMethodsInThisClass()
{
$methods = get_class_methods('ymlDomain'); $this->assertTrue( count($methods) == 11);
}
/**
* @covers ymlDomain::ymlDomain
* @todo Implement testymlDomain().
*/
public function testymlDomain()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('ymlDomain', $methods ), 'exists method ymlDomain' );
$r = new ReflectionMethod('ymlDomain', 'ymlDomain');
$params = $r->getParameters();
}
/**
* @covers ymlDomain::addDomain
* @todo Implement testaddDomain().
*/
public function testaddDomain()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('addDomain', $methods ), 'exists method addDomain' );
$r = new ReflectionMethod('ymlDomain', 'addDomain');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'domainName');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
}
/**
* @covers ymlDomain::addDomainValue
* @todo Implement testaddDomainValue().
*/
public function testaddDomainValue()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('addDomainValue', $methods ), 'exists method addDomainValue' );
$r = new ReflectionMethod('ymlDomain', 'addDomainValue');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'domainName');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
$this->assertTrue( $params[1]->getName() == 'value');
$this->assertTrue( $params[1]->isArray() == false);
$this->assertTrue( $params[1]->isOptional () == false);
}
/**
* @covers ymlDomain::exists
* @todo Implement testexists().
*/
public function testexists()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('exists', $methods ), 'exists method exists' );
$r = new ReflectionMethod('ymlDomain', 'exists');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'domainName');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
}
/**
* @covers ymlDomain::get
* @todo Implement testget().
*/
public function testget()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('get', $methods ), 'exists method get' );
$r = new ReflectionMethod('ymlDomain', 'get');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'resource');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
}
/**
* @covers ymlDomain::name2keys
* @todo Implement testname2keys().
*/
public function testname2keys()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('name2keys', $methods ), 'exists method name2keys' );
$r = new ReflectionMethod('ymlDomain', 'name2keys');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'resource');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
}
/**
* @covers ymlDomain::load
* @todo Implement testload().
*/
public function testload()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('load', $methods ), 'exists method load' );
$r = new ReflectionMethod('ymlDomain', 'load');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'resource');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
}
/**
* @covers ymlDomain::find
* @todo Implement testfind().
*/
public function testfind()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('find', $methods ), 'exists method find' );
$r = new ReflectionMethod('ymlDomain', 'find');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'nodesKey');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
$this->assertTrue( $params[1]->getName() == 'where');
$this->assertTrue( $params[1]->isArray() == false);
$this->assertTrue( $params[1]->isOptional () == false);
}
/**
* @covers ymlDomain::getNode
* @todo Implement testgetNode().
*/
public function testgetNode()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('getNode', $methods ), 'exists method getNode' );
$r = new ReflectionMethod('ymlDomain', 'getNode');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'nodeKey');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
$this->assertTrue( $params[1]->getName() == 'from');
$this->assertTrue( $params[1]->isArray() == false);
$this->assertTrue( $params[1]->isOptional () == false);
}
/**
* @covers ymlDomain::plainArray
* @todo Implement testplainArray().
*/
public function testplainArray()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('plainArray', $methods ), 'exists method plainArray' );
$r = new ReflectionMethod('ymlDomain', 'plainArray');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'array');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
}
/**
* @covers ymlDomain::arrayAppend
* @todo Implement testarrayAppend().
*/
public function testarrayAppend()
{
$methods = get_class_methods($this->object);
$this->assertTrue( in_array('arrayAppend', $methods ), 'exists method arrayAppend' );
$r = new ReflectionMethod('ymlDomain', 'arrayAppend');
$params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'to');
$this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false);
$this->assertTrue( $params[1]->getName() == 'appendFrom');
$this->assertTrue( $params[1]->isArray() == false);
$this->assertTrue( $params[1]->isOptional () == false);
}
}

View File

@@ -1,42 +0,0 @@
<?php
/**
* classTestToolsTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if ( !defined ('PATH_THIRDPARTY') ) {
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
}
require_once( PATH_THIRDPARTY . 'lime/lime.php');
define ( 'G_ENVIRONMENT', G_TEST_ENV);
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
G::LoadSystem ( 'testTools');
$t = new lime_test( 2, new lime_output_color());
$obj = "testTools";
$method = get_class_methods('testTools');
$t->diag('class testTools' );
$t->is( count($method) , 7, "class testTools " . count($method) . " methods." );
$t->todo( 'review all pendings in this class');

View File

@@ -1,92 +0,0 @@
<?php
/**
* classAppDelegationTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
require_once ( PATH_CORE . "config/databases.php");
require_once ( "propel/Propel.php" );
Propel::init( PATH_CORE . "config/databases.php");
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'error');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
G::LoadSystem ( 'dbconnection');
G::LoadSystem ( 'dbsession');
G::LoadSystem ( 'dbrecordset');
G::LoadSystem ( 'dbtable');
G::LoadSystem ( 'testTools');
G::LoadClass ( 'appDelegation');
require_once(PATH_CORE.'/classes/model/AppDelegation.php');
$dbc = new DBConnection();
$ses = new DBSession( $dbc);
$obj = new AppDelegation ($dbc);
$t = new lime_test( 1, new lime_output_color() );
$t->diag('class AppDelegation' );
$t->isa_ok( $obj , 'AppDelegation', 'class AppDelegation created');
class AppDel extends unitTest
{
function CreateEmptyAppDelegation($data,$fields)
{
$obj=new AppDelegation();
$res=$obj->createAppDelegation($fields);
return $res;
}
function CreateDuplicated($data,$fields)
{
$obj1=new AppDelegation();
$res=$obj1->createAppDelegation($fields);
$this->domain->addDomainValue('createdAppDel',serialize($fields));
$obj2=new AppDelegation();
$res=$obj2->createAppDelegation($fields);
$this->domain->addDomainValue(serialize($fields));
return $res;
}
function CreateNewAppDelegation($data,$fields)
{
$obj=new AppDelegation();
$res=$obj->createAppDelegation($fields);
$this->domain->addDomainValue('createdAppDel',serialize($fields));
return $res;
}
function DeleteAppDelegation($data,$fields)
{
$obj=new AppDelegation();
$fields=unserialize($fields['Fields']);
$obj->setAppUid($fields['APP_UID']);
$obj->setDelIndex($fields['DEL_INDEX']);
$res=$obj->delete();
return $res;
}
}
$tt=new AppDel('appDelegation.yml',$t,$domain);
$domain->addDomain("createdAppDel");
$tt->load('CreateDelApplication');
$tt->runAll();
$tt->load('DeleteCretedAppDelegations');
$tt->runAll();
?>

View File

@@ -1,153 +0,0 @@
<?php
/**
* classAppDocumentTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once(PATH_THIRDPARTY . '/lime/lime.php');
require_once(PATH_THIRDPARTY.'lime/yaml.class.php');
require_once(PATH_CORE . 'config/databases.php');
require_once('propel/Propel.php');
Propel::init(PATH_CORE . 'config/databases.php');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('error');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('dbtable');
G::LoadSystem('testTools');
require_once(PATH_CORE . 'classes/model/AppDocument.php');
$obj = new AppDocument();
$t = new lime_test(19, new lime_output_color());
$t->diag('Class AppDocument');
//class AppDocument
$t->isa_ok($obj, 'AppDocument', 'Class AppDocument created!');
//method load
$t->can_ok($obj, 'load', 'load() is callable!');
//method create
$t->can_ok($obj, 'create', 'create() is callable!');
//method update
$t->can_ok($obj, 'update', 'update() is callable!');
//method remove
$t->can_ok($obj, 'remove', 'remove() is callable!');
//method getAppDocTitle
$t->can_ok($obj, 'getAppDocTitle', 'getAppDocTitle() is callable!');
//method setAppDocTitle
$t->can_ok($obj, 'setAppDocTitle', 'setAppDocTitle() is callable!');
//method getAppDocComment
$t->can_ok($obj, 'getAppDocComment', 'getAppDocComment() is callable!');
//method setAppDocComment
$t->can_ok($obj, 'setAppDocComment', 'setAppDocComment() is callable!');
//method getAppDocFilename
$t->can_ok($obj, 'getAppDocFilename', 'getAppDocFilename() is callable!');
//method setAppDocFilename
$t->can_ok($obj, 'setAppDocFilename', 'setAppDocFilename() is callable!');
/***** TEST CLASS APPDOCUMENT *****/
///////// INITIAL VALUES /////////
define('SYS_LANG', 'en');
//Test class
class appDocumentTest extends unitTest
{
function loadTest($aTestData, $aFields)
{
$oAppDocument = new AppDocument();
try {
return $oAppDocument->load($aFields['APP_DOC_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function createTest($aTestData, $aFields)
{
$oAppDocument = new AppDocument();
try {
return $oAppDocument->create($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function updateTest($aTestData, $aFields)
{
$oAppDocument = new AppDocument();
try {
return $oAppDocument->update($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function removeTest($aTestData, $aFields)
{
$oAppDocument = new AppDocument();
try {
return $oAppDocument->remove($aFields['APP_DOC_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
}
//Initialize the test class (ymlTestDefinitionFile, limeTestObject, testDomain)
$oAppDocumentTest = new appDocumentTest('appDocument.yml', $t, new ymlDomain());
$oAppDocumentTest->load('load1');
$vAux = $oAppDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oAppDocumentTest->load('load2');
$vAux = $oAppDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oAppDocumentTest->load('create1');
$vAux = $oAppDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oAppDocumentTest->load('create2');
$vAux = $oAppDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oAppDocumentTest->load('update1');
$vAux = $oAppDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oAppDocumentTest->load('update2');
$vAux = $oAppDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oAppDocumentTest->load('remove1');
$vAux = $oAppDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oAppDocumentTest->load('remove2');
$vAux = $oAppDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
?>

View File

@@ -1,217 +0,0 @@
<?php
/**
* classApplicationTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
require_once( 'propel/Propel.php' );
Propel::init( PATH_CORE . "config/databases.php");
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'error');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
G::LoadSystem ( 'testTools');
require_once( PATH_CORE.'/classes/model/Application.php');
$obj = new Application ();
$t = new lime_test( 23, new lime_output_color() );
$t->diag('class Application' );
$t->isa_ok( $obj , 'Application', 'class Application created');
//method load
//#2
$t->can_ok( $obj, 'getAppTitle', 'getAppTitle() is callable' );
//#3
$t->can_ok( $obj, 'setAppTitle', 'setAppTitle() is callable' );
//#4
$t->can_ok( $obj, 'create', 'create() is callable' );
//#5
$t->can_ok( $obj, 'update', 'update() is callable' );
//#6
$t->can_ok( $obj, 'load', 'load() is callable' );
//#7
$t->can_ok( $obj, 'remove', 'remove() is callable' );
//#8
$t->can_ok( $obj, 'createApplication', 'createApplication() is callable' );
//getAppUid
//#9
$t->is( $obj->getAppUid(), '', 'getAppUid() return empty, when the instance doesnt have any row' );
//getAppTitle
try {
$obj = new Application ();
$res = $obj->getAppTitle();
}
catch ( Exception $e ) {
//#10
$t->isa_ok( $e, 'Exception', 'getAppTitle() return error when APP_UID is not defined' );
//#11
$t->is ( $e->getMessage(), "Error in getAppTitle, the APP_UID can't be blank", 'getAppTitle() return Error in getAppTitle, the APP_UID cant be blank' );
}
//setAppTitle
try {
$obj = new Application ();
$obj->setAppTitle('x');
}
catch ( Exception $e ) {
//#12
$t->isa_ok( $e, 'Exception', 'setAppTitle() return error when APP_UID is not defined' );
//#13
$t->is ( $e->getMessage(), "Error in setAppTitle, the APP_UID can't be blank", 'setAppTitle() return Error in getAppTitle, the APP_UID cant be blank' );
}
//create
try {
$obj = new Application ();
$res = $obj->create();
}
catch ( Exception $e ) {
//#14
$t->isa_ok( $e, 'PropelException', 'create() return error when APP_UID is not defined' );
//#15
$t->like ( $e->getMessage(), "%Unable to execute INSERT statement%", 'getAppTitle() return Error in getAppTitle, the APP_UID cant be blank' );
}
//create
try {
$obj = new Application ();
$appUid = $obj->create( '1' );
//#16
$t->isa_ok( $appUid, 'string', 'create(), creates a new application' );
//#17
$t->is ( strlen($appUid), 14, 'create(), creates a new application, Guid lenth=14 chars' );
$res = $obj->load( $appUid );
//#18
$t->isa_ok( $res, 'array', 'load(), loads a new application' );
//#19
$t->is ( $res['APP_UID'], $appUid, 'load(), loads a new application, valid APP_UID' );
//#20
$t->is ( $res['APP_FINISH_DATE'],'1902-01-01 00:00:00', 'load(), loads a new application, valid FINISH_DATE' );
//#21
$t->like ( $res['APP_TITLE'], '%#%', 'load(), loads a new application, valid APP_TITLE' );
//#22
$t->is ( $res['APP_PARENT'], '', 'load(), loads a new application, valid APP_PARENT' );
}
catch ( Exception $e ) {
$t->like ( $e->getMessage(), "%Unable to execute INSERT statement%", 'create() return Error in getAppTitle, the APP_UID cant be blank' );
}
//update with empty
try {
$obj = new Application ();
$res = $obj->update( NULL );
}
catch ( Exception $e ) {
//#23
$t->isa_ok( $e, 'Exception', 'update() returns error when APP_UID is not defined' );
//#24
$t->is ( $e->getMessage(), "The row '' in table APPLICATION doesn't exist!", "update() This row doesn't exist!" );
}
//update with $fields
$newTitle = 'new title';
$Fields['APP_UID'] = $appUid;
$Fields['APP_TITLE'] = $newTitle;
$Fields['APP_PARENT'] = rand( 1000, 5000);
$Fields['APP_INIT_DATE'] = 'now';
try {
$obj = new Application ();
$res = $obj->update( $Fields);
//#25
$t->is ( $res, 1, "update() update 1 row" );
$Fields = $obj->Load ( $appUid );
//#26
$t->is ( $obj->getAppUid(), $appUid, "update() APP_UID = ". $appUid );
//#27
$t->is ( $obj->getAppTitle(), $newTitle, "update() getAppTitle" );
//#28
$t->is ( $Fields['APP_TITLE'], $newTitle, "update() APP_TITLE= ". $newTitle );
//#29
$t->is ( $Fields['APP_INIT_DATE'], date('Y-m-d H:i:s'), "update() APP_INIT_DATE= ". date('Y-m-d H:i:s') );
}
catch ( Exception $e ) {
//#14
// $t->isa_ok( $e, 'PropelException', 'update() return error ' . $e->getMessage() );
$t->isa_ok( $e, 'Exception', 'update() return error ' . $e->getMessage() );
}
//remove with empty
try {
$obj = new Application ();
$res = $obj->remove( NULL );
}
catch ( Exception $e ) {
//#30
$t->isa_ok( $e, 'Exception', 'remove() returns error when APP_UID is not defined' );
//#31
$t->is ( $e->getMessage(), "The row '' in table Application doesn't exist!", "remove() This row doesn't exist!" );
}
/*
//remove with $fields
$Fields['APP_UID'] = $appUid;
try {
$obj = new Application ();
//$res = $obj->remove( $Fields );
$t->todo ( "check why this sentence is not working : $res = $obj->remove( $Fields ); " );
//#32
$t->is ( $res, NULL, "remove() remove row $appUid" );
}
catch ( Exception $e ) {
//#14
// $t->isa_ok( $e, 'PropelException', 'remove() return error ' . $e->getMessage() );
$t->isa_ok( $e, 'Exception', 'remove() return error ' . $e->getMessage() );
}
//remove with $appUid
$obj = new Application ();
$appUid = $obj->create( '1' );
try {
$obj = new Application ();
//$res = $obj->remove ($appUid );
//#33
//$t->is ( $res, NULL, "remove() remove row $appUid" );
}
catch ( Exception $e ) {
//#14
$t->isa_ok( $e, 'PropelException', 'remove() return error ' . $e->getMessage() );
}
*/
$t->todo( 'Test to verify if delete works correctly :p ...');
$t->todo( 'how can I change dynamically the Case Title based in a definition, right now the case title is the same as the process title. We need another field in process to have the case title definition');
?>

View File

@@ -1,135 +0,0 @@
<?php
/**
* classConfigurationTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
require_once ( PATH_CORE . "config/databases.php");
require_once ( "propel/Propel.php" );
Propel::init( PATH_CORE . "config/databases.php");
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'error');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
G::LoadSystem ( 'dbconnection');
G::LoadSystem ( 'dbsession');
G::LoadSystem ( 'dbrecordset');
G::LoadSystem ( 'dbtable');
//G::LoadClass ( 'user');
G::LoadSystem ( 'testTools');
require_once(PATH_CORE.'/classes/model/Configuration.php');
require_once ( PATH_CORE . "config/databases.php");
$dbc = new DBConnection();
$ses = new DBSession( $dbc);
$obj = new Configuration ($dbc);
$t = new lime_test( 25, new lime_output_color() );
$t->diag('class Configuration' );
$t->isa_ok( $obj , 'Configuration', 'class Configuration created');
//method load
$t->can_ok( $obj, 'load', 'load() is callable' );
//method save
$t->can_ok( $obj, 'update', 'update() is callable' );
//method delete
$t->can_ok( $obj, 'delete', 'delete() is callable' );
//method create
$t->can_ok( $obj, 'create', 'create() is callable' );
class ConfigurationTest extends UnitTest
{
function CreateConfiguration($data,$fields)
{
try
{
$Configuration=new Configuration();
$result=$Configuration->create($fields);
$this->domain->addDomainValue('CREATED_UID',$Configuration->getCfgUid());
$this->domain->addDomainValue('CREATED_OBJ',$Configuration->getObjUid());
$this->domain->addDomainValue('CREATED_PRO',$Configuration->getProUid());
$this->domain->addDomainValue('CREATED_USR',$Configuration->getUsrUid());
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function UpdateConfiguration($data,$fields)
{
try
{
$Configuration=new Configuration();
$result=$Configuration->update($fields);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function LoadConfiguration($data,$fields)
{
try
{
$Configuration=new Configuration();
$result=$Configuration->load($fields['CFG_UID'], $fields['OBJ_UID'], $fields['PRO_UID'], $fields['USR_UID'], $fields['APP_UID']);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function RemoveConfiguration($data,$fields)
{
try
{
$Configuration=new Configuration();
$result=$Configuration->remove($fields['CFG_UID'], $fields['OBJ_UID'], $fields['PRO_UID'], $fields['USR_UID'], $fields['APP_UID']);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
}
$test=new ConfigurationTest('configuration.yml',$t);
$test->domain->addDomain('CREATED_UID');
$test->domain->addDomain('CREATED_OBJ');
$test->domain->addDomain('CREATED_PRO');
$test->domain->addDomain('CREATED_USR');
$test->load('CreateTestConfigurations');
$test->runAll();
$test->load('ConfigurationUnitTest');
$test->runAll();

View File

@@ -1,149 +0,0 @@
<?php
/**
* classContentTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
require_once( PATH_CORE . "config/databases.php");
require_once( 'propel/Propel.php' );
Propel::init( PATH_CORE . "config/databases.php");
G::LoadSystem ( 'testTools');
G::LoadThirdParty('smarty/libs','Smarty.class');
require_once(PATH_CORE.'/classes/model/Content.php');
class ContentTest extends unitTest
{
function LoadContent($data, $fields)
{
$obj = new Content();
$ConCategory = $fields['CON_CATEGORY'];
$ConParent = $fields['CON_PARENT'];
$ConId = $fields['CON_ID'];
$ConLang = $fields['CON_LANG'];
$ConValue = $fields['CON_VALUE'];
try {
$res = $obj->load($ConCategory, $ConParent, $ConId, $ConLang );
if ( $res == '' ) {
$this->testLime->is ( $res, '', 'Load Empty Content ' );
}
else
$this->testLime->is ( $ConValue, $ConValue, 'correct value from Content->Load ' );
}
catch ( Exception $e) {
return $e;
}
return $res;
}
function deleteContent($data, $fields)
{
$obj = new Content();
$ConCategory = $fields['CON_CATEGORY'];
$ConParent = $fields['CON_PARENT'];
$ConId = $fields['CON_ID'];
$ConLang = $fields['CON_LANG'];
try {
//$res = $obj->load($ConCategory, $ConParent, $ConId, $ConLang );
$content = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $ConLang );
if ( $content )
$content->delete( );
}
catch ( Exception $e) {
return $e;
}
return $res;
}
function addContent($data, $fields)
{
$obj=new Content();
$ConCategory = $fields['CON_CATEGORY'];
$ConParent = $fields['CON_PARENT'];
$ConId = $fields['CON_ID'];
$ConLang = $fields['CON_LANG'];
$ConValue = $fields['CON_VALUE'];
try {
$res = $obj->addContent($ConCategory, $ConParent, $ConId, $ConLang, $ConValue );
}
catch ( Exception $e) {
return $e;
}
return $res;
}
}
$obj = new Content();
//$t = new lime_test( 5, new lime_output_color() );
$t = new lime_test( 12, new lime_output_color() );
$t->diag('class Content' );
$t->isa_ok( $obj , 'Content', 'class Content created');
$t->todo( 'review all combinations of is_utf8 ');
$t->todo( 'review is_utf8 should be in another class');
//Initialize the global domain (It is optional)
$testDomain = new ymlDomain();
$test = new ContentTest ('content.yml', $t, $testDomain );
//check if an row exists,
$test->load('loadContent');
$test->runSingle();
//check if an row exists,
$test->load('deleteContent');
$test->runAll();
$test->load('addContentAcentos');
$test->runSingle();
//add the same row twice, the first time goes good, but the second the class throw an error
$test->load('addContent1');
$test->runSingle();
$test->load('addContentTwice');
$test->runSingle();
$test->load('loadContent');
$test->runSingle();
$obj = new Content();
$res = $obj->addContent ('1','2','3','en','language1');
$res = $obj->addContent ('1','2','3','es','language2');
$res = $obj->addContent ('1','2','3','pt','language3');
$res = $obj->addContent ('1','2','3','fr','language4');
$res = $obj->addContent ('1','2','3','it','language5');
$res = $obj->removeContent ('1','2','3');
//$t->can_ok( $res, 'getAppTitle', 'removeContent.' );

View File

@@ -1,149 +0,0 @@
<?php
/**
* classDerivationTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
require_once ( PATH_CORE . "config/databases.php");
require_once ( "propel/Propel.php" );
Propel::init( PATH_CORE . "config/databases.php");
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'error');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
G::LoadSystem ( 'dbconnection');
G::LoadSystem ( 'dbsession');
G::LoadSystem ( 'dbrecordset');
G::LoadSystem ( 'dbtable');
G::LoadSystem ( 'testTools');
G::LoadClass ( 'derivation');
//G::LoadClass('task');
//G::LoadClass('application');
global $dbc;
$dbc = new DBConnection();
$ses = new DBSession( $dbc);
$obj = new Derivation ($dbc);
$t = new lime_test( 1 , new lime_output_color() );
$t->diag('class Derivation' );
$t->isa_ok( $obj , 'Derivation', 'class Derivation created');
/*
//method startCase
//$t->can_ok( $obj, 'startCase', 'startCase() is callable' );
$t->todo ( $obj ." --> startCase " );
// $result = $obj->startCase ( $aData);
// $t->isa_ok( $result, 'NULL', 'call to method startCase ');
//method prepareInformation
$t->can_ok( $obj, 'prepareInformation', 'prepareInformation() is callable' );
// $result = $obj->prepareInformation ( $aData);
// $t->isa_ok( $result, 'NULL', 'call to method prepareInformation ');
//method getNextAssignedUser
$t->can_ok( $obj, 'getNextAssignedUser', 'getNextAssignedUser() is callable' );
// $result = $obj->getNextAssignedUser ( $tasInfo);
// $t->isa_ok( $result, 'NULL', 'call to method getNextAssignedUser ');
//method derivate
$t->can_ok( $obj, 'derivate', 'derivate() is callable' );
// $result = $obj->derivate ( $currentDelegation, $nextDelegations);
// $t->isa_ok( $result, 'NULL', 'call to method derivate ');
//method isOpen
//$t->can_ok( $obj, 'isOpen', 'isOpen() is callable' );
$t->todo( $obj ."not --> isOpen() is callable" );
// $result = $obj->isOpen ( $appUID, $tasUID);
// $t->isa_ok( $result, 'NULL', 'call to method isOpen ');
//$t->fail( 'review all pendings methods in this class');
/***** TEST CLASS DERIVATION *****/
///////// INITIAL VALUES /////////
define('SYS_LANG','en');
//Test Class
class derivationTest extends unitTest
{
function StartCaseTest( $testCase, $Fields )
{
global $dbc;
$der = new Derivation( $dbc );
$result = $der->startCase( $Fields );
return $result;
}
function DeleteCase( $testCase, $Fields )
{
global $dbc;
$app= new Application( $dbc );
return $app->delete( $Fields['APP_UID'] );
}
function derivate( $testCase, &$testDomain, &$t )
{
}
}
/***************************/
die;
/***************************/
//Initialize the global domain (It is optional)
$testDomain = new ymlDomain();
//Initialize the testClass ( ymlTestDefinitionFile, limeTestObject, testDomain )
$test = new derivationTest('derivation.yml', $t, $testDomain );
$test->load('StartCase1');
$vAux = $test->runSingle();//var_dump($vAux);die;
$t->isa_ok( $vAux['APPLICATION'], 'string', 'Verify if APPLICATION is a string' );
$t->is( $vAux['INDEX'], 1, 'Verify if DEL_INDEX is 1' );
$t->isa_ok( $vAux['PROCESS'], 'string', 'Verify if PROCESS is a string' );
/*$test->load('StartCase2');
$test->runSingle();
$test->load('StartCase3');
$test->runSingle();
$test->load('StartCase4');
$test->runSingle();
$test->load('StartCase5');
$test->runSingle();*/
//$test->load('DeleteCreatedApplications');
//$test->runAll();

View File

@@ -1,120 +0,0 @@
<?php
/**
* classDynaformTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
require_once( 'propel/Propel.php' );
Propel::init( PATH_CORE . "config/databases.php");
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'error');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
G::LoadSystem ( 'testTools');
require_once( PATH_CORE.'/classes/model/Dynaform.php');
$obj = new Dynaform ();
$t = new lime_test( 18, new lime_output_color() );
$t->diag('class Dynaform' );
$t->isa_ok( $obj , 'Dynaform', 'class Dynaform created');
//method load
//#2
$t->can_ok( $obj, 'getDynTitle', 'getDynTitle() is callable' );
//#3
$t->can_ok( $obj, 'setDynTitle', 'setDynTitle() is callable' );
//#4
$t->can_ok( $obj, 'getDynDescription', 'getDynDescription() is callable' );
//#5
$t->can_ok( $obj, 'setDynDescription', 'setDynDescription() is callable' );
//#6
$t->can_ok( $obj, 'create', 'create() is callable' );
//#7
$t->can_ok( $obj, 'update', 'update() is callable' );
//#8
$t->can_ok( $obj, 'load', 'load() is callable' );
//#9
$t->can_ok( $obj, 'remove', 'remove() is callable' );
//getDynUid
//#10
$t->is( $obj->getDynUid(), '', 'getDynUid() return empty, when the instance doesnt have any row' );
//getDynTitle
try {
$obj = new Dynaform ();
$res = $obj->getDynTitle();
}
catch ( Exception $e ) {
//#11
$t->isa_ok( $e, 'Exception', 'getDynTitle() return error when DYN_UID is not defined' );
//#12
$t->is ( $e->getMessage(), "Error in getDynTitle, the DYN_UID can't be blank", 'getDynTitle() return Error in getDynTitle, the DYN_UID cant be blank' );
}
//setDynDescription
try {
$obj = new Dynaform ();
$obj->setDynDescription('x');
}
catch ( Exception $e ) {
//#13
$t->isa_ok( $e, 'Exception', 'setDynDescription() return error when DYN_UID is not defined' );
//#14
$t->is ( $e->getMessage(), "Error in setDynDescription, the DYN_UID can't be blank", 'setDynDescription() return Error in getAppTitle, the APP_UID cant be blank' );
}
//getDynDescription
try {
$obj = new Dynaform ();
$res = $obj->getDynDescription();
}
catch ( Exception $e ) {
//#15
$t->isa_ok( $e, 'Exception', 'getDynDescription() return error when DYN_UID is not defined' );
//#16
$t->is ( $e->getMessage(), "Error in getDynDescription, the DYN_UID can't be blank", 'getDynDescription() return Error in getDynDescription, the DYN_UID cant be blank' );
}
//setAppDescription
try {
$obj = new Dynaform ();
$obj->setDynDescription('x');
}
catch ( Exception $e ) {
//#17
$t->isa_ok( $e, 'Exception', 'setAppDescription() return error when DYN_UID is not defined' );
//#18
$t->is ( $e->getMessage(), "Error in setDynDescription, the DYN_UID can't be blank", 'setAppDescription() return Error in getAppDescription, the APP_UID cant be blank' );
}

View File

@@ -1,77 +0,0 @@
<?php
/**
* classGroupTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
require_once( 'propel/Propel.php' );
Propel::init( PATH_CORE . "config/databases.php");
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'error');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
G::LoadSystem ( 'testTools');
require_once( PATH_CORE.'/classes/model/Groupwf.php');
$obj = new Groupwf ();
$t = new lime_test( 10, new lime_output_color() );
$t->diag('class Groupwf' );
$t->isa_ok( $obj , 'Groupwf', 'class Groupwf created');
//method load
//#2
$t->can_ok( $obj, 'getGrpTitle', 'getGrpTitle() is callable' );
//#3
$t->can_ok( $obj, 'setGrpTitle', 'setGrpTitle() is callable' );
//#4
$t->can_ok( $obj, 'create', 'create() is callable' );
//#5
$t->can_ok( $obj, 'update', 'update() is callable' );
//#6
$t->can_ok( $obj, 'load', 'load() is callable' );
//#7
$t->can_ok( $obj, 'remove', 'remove() is callable' );
//getGrpUid
//#8
$t->is( $obj->getGrpUid(), '', 'getGrpUid() return empty, when the instance doesnt have any row' );
//getGrpTitle
try {
$obj = new Groupwf ();
$res = $obj->getGrpTitle();
}
catch ( Exception $e ) {
//#9
$t->isa_ok( $e, 'Exception', 'getGrpTitle() return error when GRP_UID is not defined' );
//#10
$t->is ( $e->getMessage(), "Error in getGrpTitle, the GRP_UID can't be blank", 'getGrpTitle() return Error in getGrpTitle, the GRP_UID cant be blank' );
}

View File

@@ -1,98 +0,0 @@
<?php
/**
* classGroupUserTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once(PATH_THIRDPARTY . '/lime/lime.php');
require_once(PATH_THIRDPARTY.'lime/yaml.class.php');
require_once(PATH_CORE . 'config/databases.php');
require_once('propel/Propel.php');
Propel::init(PATH_CORE . 'config/databases.php');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('error');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('dbtable');
G::LoadSystem('testTools');
require_once(PATH_CORE . 'classes/model/GroupUser.php');
$obj = new GroupUser();
$t = new lime_test(3, new lime_output_color());
$t->diag('Class GroupUser');
//class GroupUser
$t->isa_ok($obj, 'GroupUser', 'Class GroupUser created!');
//method create
$t->can_ok($obj, 'create', 'create() is callable!');
//method remove
$t->can_ok($obj, 'remove', 'remove() is callable!');
/***** TEST CLASS GROUPUSER *****/
///////// INITIAL VALUES /////////
define('SYS_LANG', 'en');
//Test class
class GroupUserTest extends unitTest
{
function createTest($aTestData, $aFields)
{
$oGroupUser = new GroupUser();
try {
return $oGroupUser->create($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function removeTest($aTestData, $aFields)
{
$oGroupUser = new GroupUser();
try {
return $oGroupUser->remove($aFields['GRP_UID'], $aFields['USR_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
}
//Initialize the test class (ymlTestDefinitionFile, limeTestObject, testDomain)
$oGroupUserTest = new GroupUserTest('groupUser.yml', $t, new ymlDomain());
$oGroupUserTest->load('create1');
$vAux = $oGroupUserTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oGroupUserTest->load('create2');
$vAux = $oGroupUserTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oGroupUserTest->load('remove1');
$vAux = $oGroupUserTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oGroupUserTest->load('remove2');
$vAux = $oGroupUserTest->runSingle();
//var_dump($vAux);echo "\n\n";
?>

View File

@@ -1,175 +0,0 @@
<?php
/**
* classGroupsTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
require_once( 'propel/Propel.php' );
require_once ( "creole/Creole.php" );
require_once ( PATH_CORE . "config/databases.php");
G::LoadClass ( 'groups');
$obj = new Groups ($dbc);
$t = new lime_test( 29, new lime_output_color() );
$className = Groups;
$className = strtolower ( substr ($className, 0,1) ) . substr ($className, 1 );
$reflect = new ReflectionClass( $className );
$method = array ( );
$testItems = 0;
foreach ( $reflect->getMethods() as $reflectmethod ) {
$params = '';
foreach ( $reflectmethod->getParameters() as $key => $row ) {
if ( $params != '' ) $params .= ', ';
$params .= '$' . $row->name;
}
$testItems++;
$methods[ $reflectmethod->getName() ] = $params;
}
//To change the case only the first letter of each word, TIA
$className = ucwords($className);
$t->diag("class $className" );
$t->isa_ok( $obj , $className, "class $className created");
$t->is( count($methods) , 14, "class $className have " . 14 . ' methods.' );
//checking method 'getUsersOfGroup'
$t->can_ok( $obj, 'getUsersOfGroup', 'getUsersOfGroup() is callable' );
//$result = $obj->getUsersOfGroup ( $sGroupUID);
//$t->isa_ok( $result, 'NULL', 'call to method getUsersOfGroup ');
$t->todo( "call to method getUsersOfGroup using $sGroupUID ");
//checking method 'getActiveGroupsForAnUser'
$t->can_ok( $obj, 'getActiveGroupsForAnUser', 'getActiveGroupsForAnUser() is callable' );
//$result = $obj->getActiveGroupsForAnUser ( $sUserUID);
//$t->isa_ok( $result, 'NULL', 'call to method getActiveGroupsForAnUser ');
$t->todo( "call to method getActiveGroupsForAnUser using $sUserUID ");
//checking method 'addUserToGroup'
$t->can_ok( $obj, 'addUserToGroup', 'addUserToGroup() is callable' );
//$result = $obj->addUserToGroup ( $GrpUid, $UsrUid);
//$t->isa_ok( $result, 'NULL', 'call to method addUserToGroup ');
$t->todo( "call to method addUserToGroup using $GrpUid, $UsrUid ");
//checking method 'removeUserOfGroup'
$t->can_ok( $obj, 'removeUserOfGroup', 'removeUserOfGroup() is callable' );
//$result = $obj->removeUserOfGroup ( $GrpUid, $UsrUid);
//$t->isa_ok( $result, 'NULL', 'call to method removeUserOfGroup ');
$t->todo( "call to method removeUserOfGroup using $GrpUid, $UsrUid ");
//checking method 'getAllGroups'
$t->can_ok( $obj, 'getAllGroups', 'getAllGroups() is callable' );
//$result = $obj->getAllGroups ( );
//$t->isa_ok( $result, 'NULL', 'call to method getAllGroups ');
$t->todo( "call to method getAllGroups using ");
//checking method 'getUserGroups'
$t->can_ok( $obj, 'getUserGroups', 'getUserGroups() is callable' );
//$result = $obj->getUserGroups ( $sUserUID);
//$t->isa_ok( $result, 'NULL', 'call to method getUserGroups ');
$t->todo( "call to method getUserGroups using $sUserUID ");
//checking method 'removeUserOfAllGroups'
$t->can_ok( $obj, 'removeUserOfAllGroups', 'removeUserOfAllGroups() is callable' );
//$result = $obj->removeUserOfAllGroups ( $sUserUID);
//$t->isa_ok( $result, 'NULL', 'call to method removeUserOfAllGroups ');
$t->todo( "call to method removeUserOfAllGroups using $sUserUID ");
//checking method 'getUsersGroupCriteria'
$t->can_ok( $obj, 'getUsersGroupCriteria', 'getUsersGroupCriteria() is callable' );
//$result = $obj->getUsersGroupCriteria ( $sGroupUID);
//$t->isa_ok( $result, 'NULL', 'call to method getUsersGroupCriteria ');
$t->todo( "call to method getUsersGroupCriteria using $sGroupUID ");
//checking method 'getUserGroupsCriteria'
$t->can_ok( $obj, 'getUserGroupsCriteria', 'getUserGroupsCriteria() is callable' );
//$result = $obj->getUserGroupsCriteria ( $sUserUID);
//$t->isa_ok( $result, 'NULL', 'call to method getUserGroupsCriteria ');
$t->todo( "call to method getUserGroupsCriteria using $sUserUID ");
//checking method 'getNumberGroups'
$t->can_ok( $obj, 'getNumberGroups', 'getNumberGroups() is callable' );
//$result = $obj->getNumberGroups ( $sUserUID);
//$t->isa_ok( $result, 'NULL', 'call to method getNumberGroups ');
$t->todo( "call to method getNumberGroups using $sUserUID ");
//checking method 'getAvailableUsersCriteria'
$t->can_ok( $obj, 'getAvailableUsersCriteria', 'getAvailableUsersCriteria() is callable' );
//$result = $obj->getAvailableUsersCriteria ( $sGroupUID);
//$t->isa_ok( $result, 'NULL', 'call to method getAvailableUsersCriteria ');
$t->todo( "call to method getAvailableUsersCriteria using $sGroupUID ");
//checking method 'verifyUsertoGroup'
$t->can_ok( $obj, 'verifyUsertoGroup', 'verifyUsertoGroup() is callable' );
//$result = $obj->verifyUsertoGroup ( $GrpUid, $UsrUid);
//$t->isa_ok( $result, 'NULL', 'call to method verifyUsertoGroup ');
$t->todo( "call to method verifyUsertoGroup using $GrpUid, $UsrUid ");
//checking method 'verifyGroup'
$t->can_ok( $obj, 'verifyGroup', 'verifyGroup() is callable' );
//$result = $obj->verifyGroup ( $sGroupUID);
//$t->isa_ok( $result, 'NULL', 'call to method verifyGroup ');
$t->todo( "call to method verifyGroup using $sGroupUID ");
$t->todo ( 'review all pendings methods in this class');

View File

@@ -1,148 +0,0 @@
<?php
/**
* classInputDocumentTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once(PATH_THIRDPARTY . '/lime/lime.php');
require_once(PATH_THIRDPARTY.'lime/yaml.class.php');
require_once(PATH_CORE . 'config/databases.php');
require_once('propel/Propel.php');
Propel::init(PATH_CORE . 'config/databases.php');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('error');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('dbtable');
G::LoadSystem('testTools');
require_once(PATH_CORE . 'classes/model/InputDocument.php');
$obj = new InputDocument();
$t = new lime_test(9, new lime_output_color());
$t->diag('Class InputDocument');
//class InputDocument
$t->isa_ok($obj, 'InputDocument', 'Class InputDocument created!');
//method load
$t->can_ok($obj, 'load', 'load() is callable!');
//method create
$t->can_ok($obj, 'create', 'create() is callable!');
//method update
$t->can_ok($obj, 'update', 'update() is callable!');
//method remove
$t->can_ok($obj, 'remove', 'remove() is callable!');
//method getInpDocTitle
$t->can_ok($obj, 'getInpDocTitle', 'getInpDocTitle() is callable!');
//method setInpDocTitle
$t->can_ok($obj, 'setInpDocTitle', 'setInpDocTitle() is callable!');
//method getInpDocComment
$t->can_ok($obj, 'getInpDocDescription', 'getInpDocDescription() is callable!');
//method setInpDocComment
$t->can_ok($obj, 'setInpDocDescription', 'setInpDocDescription() is callable!');
/***** TEST CLASS INPUTDOCUMENT *****/
///////// INITIAL VALUES /////////
define('SYS_LANG', 'en');
//Test class
class InputDocumentTest extends unitTest
{
function loadTest($aTestData, $aFields)
{
$oInputDocument = new InputDocument();
try {
return $oInputDocument->load($aFields['INP_DOC_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function createTest($aTestData, $aFields)
{
$oInputDocument = new InputDocument();
try {
return $oInputDocument->create($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function updateTest($aTestData, $aFields)
{
$oInputDocument = new InputDocument();
try {
return $oInputDocument->update($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function removeTest($aTestData, $aFields)
{
$oInputDocument = new InputDocument();
try {
return $oInputDocument->remove($aFields['INP_DOC_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
}
//Initialize the test class (ymlTestDefinitionFile, limeTestObject, testDomain)
$oInputDocumentTest = new InputDocumentTest('inputDocument.yml', $t, new ymlDomain());
$oInputDocumentTest->load('load1');
$vAux = $oInputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oInputDocumentTest->load('load2');
$vAux = $oInputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oInputDocumentTest->load('create1');
$vAux = $oInputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oInputDocumentTest->load('create2');
$vAux = $oInputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oInputDocumentTest->load('update1');
$vAux = $oInputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oInputDocumentTest->load('update2');
$vAux = $oInputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oInputDocumentTest->load('remove1');
$vAux = $oInputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oInputDocumentTest->load('remove2');
$vAux = $oInputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
?>

View File

@@ -1,160 +0,0 @@
<?php
/**
* classOutputDocumentTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once(PATH_THIRDPARTY . '/lime/lime.php');
require_once(PATH_THIRDPARTY.'lime/yaml.class.php');
require_once(PATH_CORE . 'config/databases.php');
require_once('propel/Propel.php');
Propel::init(PATH_CORE . 'config/databases.php');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('error');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('dbtable');
G::LoadSystem('testTools');
require_once(PATH_CORE . 'classes/model/OutputDocument.php');
$obj = new OutputDocument();
$t = new lime_test(21, new lime_output_color());
$t->diag('Class OutputDocument');
//class OutputDocument
$t->isa_ok($obj, 'OutputDocument', 'Class OutputDocument created!');
//method load
$t->can_ok($obj, 'load', 'load() is callable!');
//method create
$t->can_ok($obj, 'create', 'create() is callable!');
//method update
$t->can_ok($obj, 'update', 'update() is callable!');
//method remove
$t->can_ok($obj, 'remove', 'remove() is callable!');
//method getOutDocTitle
$t->can_ok($obj, 'getOutDocTitle', 'getOutDocTitle() is callable!');
//method setOutDocTitle
$t->can_ok($obj, 'setOutDocTitle', 'setOutDocTitle() is callable!');
//method getOutDocComment
$t->can_ok($obj, 'getOutDocDescription', 'getOutDocDescription() is callable!');
//method setOutDocComment
$t->can_ok($obj, 'setOutDocDescription', 'setOutDocDescription() is callable!');
//method getOutDocFilename
$t->can_ok($obj, 'getOutDocFilename', 'getOutDocFilename() is callable!');
//method setOutDocFilename
$t->can_ok($obj, 'setOutDocFilename', 'setOutDocFilename() is callable!');
//method getOutDocTemplate
$t->can_ok($obj, 'getOutDocTemplate', 'getOutDocTemplate() is callable!');
//method setOutDocTemplate
$t->can_ok($obj, 'setOutDocTemplate', 'setOutDocTemplate() is callable!');
/***** TEST CLASS OUTPUTDOCUMENT *****/
///////// INITIAL VALUES /////////
define('SYS_LANG', 'en');
//Test class
class OutputDocumentTest extends unitTest
{
function loadTest($aTestData, $aFields)
{
$oOutputDocument = new OutputDocument();
try {
return $oOutputDocument->load($aFields['OUT_DOC_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function createTest($aTestData, $aFields)
{
$oOutputDocument = new OutputDocument();
try {
return $oOutputDocument->create($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function updateTest($aTestData, $aFields)
{
$oOutputDocument = new OutputDocument();
try {
return $oOutputDocument->update($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function removeTest($aTestData, $aFields)
{
$oOutputDocument = new OutputDocument();
try {
return $oOutputDocument->remove($aFields['OUT_DOC_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
}
//Initialize the test class (ymlTestDefinitionFile, limeTestObject, testDomain)
$oOutputDocumentTest = new OutputDocumentTest('outputDocument.yml', $t, new ymlDomain());
$oOutputDocumentTest->load('load1');
$vAux = $oOutputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oOutputDocumentTest->load('load2');
$vAux = $oOutputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oOutputDocumentTest->load('create1');
$vAux = $oOutputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oOutputDocumentTest->load('create2');
$vAux = $oOutputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oOutputDocumentTest->load('update1');
$vAux = $oOutputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oOutputDocumentTest->load('update2');
$vAux = $oOutputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oOutputDocumentTest->load('remove1');
$vAux = $oOutputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oOutputDocumentTest->load('remove2');
$vAux = $oOutputDocumentTest->runSingle();
//var_dump($vAux);echo "\n\n";
?>

View File

@@ -1,587 +0,0 @@
<?php
/**
* classProcessMapTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once(PATH_THIRDPARTY . 'lime/lime.php');
require_once(PATH_THIRDPARTY . 'lime/yaml.class.php');
require_once(PATH_CORE . 'config/databases.php');
require_once('propel/Propel.php');
Propel::init(PATH_CORE . 'config/databases.php');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('error');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('dbtable');
G::LoadClass('plugin');
G::LoadSystem('dbconnection');
G::LoadSystem('dbsession');
G::LoadSystem('dbrecordset');
G::LoadSystem('templatePower');
G::LoadSystem('publisher');
G::LoadSystem('headPublisher');
G::LoadSystem('pagedTable');
$oHeadPublisher =& headPublisher::getSingleton();
G::LoadSystem('testTools');
G::LoadClass('processMap');
$obj = new processMap();
$t = new lime_test(30, new lime_output_color());
$t->diag('Class processMap');
//class processMap
$t->isa_ok($obj, 'processMap', 'Class processMap created!');
//method load
$t->can_ok($obj, 'load', 'load() is callable!');
//method createProcess
$t->can_ok($obj, 'createProcess', 'createProcess() is callable!');
//method updateProcess
$t->can_ok($obj, 'updateProcess', 'updateProcess() is callable!');
//method editProcess
$t->can_ok($obj, 'editProcess', 'editProcess() is callable!');
//method saveTitlePosition
$t->can_ok($obj, 'saveTitlePosition', 'saveTitlePosition() is callable!');
//method steps
$t->can_ok($obj, 'steps', 'steps() is callable!');
//method users
$t->can_ok($obj, 'users', 'users() is callable!');
//method stepsConditions
$t->can_ok($obj, 'stepsConditions', 'stepsConditions() is callable!');
//method stepsTriggers
$t->can_ok($obj, 'stepsTriggers', 'stepsTriggers() is callable!');
//method addTask
$t->can_ok($obj, 'addTask', 'addTask() is callable!');
//method editTaskProperties
$t->can_ok($obj, 'editTaskProperties', 'editTaskProperties() is callable!');
//method saveTaskPosition
$t->can_ok($obj, 'saveTaskPosition', 'saveTaskPosition() is callable!');
//method deleteTask
$t->can_ok($obj, 'deleteTask', 'deleteTask() is callable!');
//method addGuide
$t->can_ok($obj, 'addGuide', 'addGuide() is callable!');
//method saveGuidePosition
$t->can_ok($obj, 'saveGuidePosition', 'saveGuidePosition() is callable!');
//method deleteGuide
$t->can_ok($obj, 'deleteGuide', 'deleteGuide() is callable!');
//method deleteGuides
$t->can_ok($obj, 'deleteGuides', 'deleteGuides() is callable!');
//method addText
$t->can_ok($obj, 'addText', 'addText() is callable!');
//method updateText
$t->can_ok($obj, 'updateText', 'updateText() is callable!');
//method saveTextPosition
$t->can_ok($obj, 'saveTextPosition', 'saveTextPosition() is callable!');
//method deleteText
$t->can_ok($obj, 'deleteText', 'deleteText() is callable!');
//method dynaformsList
$t->can_ok($obj, 'dynaformsList', 'dynaformsList() is callable!');
//method outputdocsList
$t->can_ok($obj, 'outputdocsList', 'outputdocsList() is callable!');
//method inputdocsList
$t->can_ok($obj, 'inputdocsList', 'inputdocsList() is callable!');
//method triggersList
$t->can_ok($obj, 'triggersList', 'triggersList() is callable!');
//method messagesList
$t->can_ok($obj, 'messagesList', 'messagesList() is callable!');
//method currentPattern
$t->can_ok($obj, 'currentPattern', 'currentPattern() is callable!');
//method newPattern
$t->can_ok($obj, 'newPattern', 'newPattern() is callable!');
//method deleteDerivation
$t->can_ok($obj, 'deleteDerivation', 'deleteDerivation() is callable!');
/***** TEST CLASS PROCESSMAP *****/
///////// INITIAL VALUES /////////
define('SYS_LANG', 'en');
//Test class
class processMapTest extends unitTest {
function loadTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->load($aFields['PRO_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function createProcessTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->createProcess($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function updateProcessTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->updateProcess($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function editProcessTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->editProcess($aFields['PRO_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function saveTitlePositionTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->saveTitlePosition($aFields['PRO_UID'], $aFields['PRO_X'], $aFields['PRO_Y']);
}
catch (Exception $oError) {
return $oError;
}
}
function stepsTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->steps($aFields['PRO_UID'], $aFields['TAS_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function usersTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->users($aFields['PRO_UID'], $aFields['TAS_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function stepsConditionsTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->stepsConditions($aFields['PRO_UID'], $aFields['TAS_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function stepsTriggersTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->stepsTriggers($aFields['PRO_UID'], $aFields['TAS_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function addTaskTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->addTask($aFields['PRO_UID'], $aFields['TAS_X'], $aFields['TAS_Y']);
}
catch (Exception $oError) {
return $oError;
}
}
function editTaskPropertiesTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->editTaskProperties($aFields['TAS_UID'], $aFields['iForm'], $aFields['iIndex']);
}
catch (Exception $oError) {
return $oError;
}
}
function saveTaskPositionTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->saveTaskPosition($aFields['TAS_UID'], $aFields['TAS_X'], $aFields['TAS_Y']);
}
catch (Exception $oError) {
return $oError;
}
}
function deleteTaskTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->deleteTask($aFields['TAS_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function addGuideTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->addGuide($aFields['PRO_UID'], $aFields['iPosition'], $aFields['sDirection']);
}
catch (Exception $oError) {
return $oError;
}
}
function saveGuidePositionTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->saveGuidePosition($aFields['SWI_UID'], $aFields['iPosition'], $aFields['sDirection']);
}
catch (Exception $oError) {
return $oError;
}
}
function deleteGuideTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->deleteGuide($aFields['SWI_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function deleteGuidesTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->deleteGuides($aFields['PRO_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function addTextTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->addText($aFields['PRO_UID'], $aFields['SWI_TEXT'], $aFields['SWI_X'], $aFields['SWI_Y']);
}
catch (Exception $oError) {
return $oError;
}
}
function updateTextTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->updateText($aFields['SWI_UID'], $aFields['SWI_TEXT']);
}
catch (Exception $oError) {
return $oError;
}
}
function saveTextPositionTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->saveTextPosition($aFields['SWI_UID'], $aFields['SWI_X'], $aFields['SWI_X']);
}
catch (Exception $oError) {
return $oError;
}
}
function deleteTextTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->deleteText($aFields['SWI_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function dynaformsListTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->dynaformsList($aFields['PRO_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function outputdocsListTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->outputdocsList($aFields['PRO_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function inputdocsListTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->inputdocsList($aFields['PRO_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function triggersListTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->triggersList($aFields['PRO_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function messagesListTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->messagesList($aFields['PRO_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function currentPatternTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->currentPattern($aFields['PRO_UID'], $aFields['TAS_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function newPatternTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->newPattern($aFields['PRO_UID'], $aFields['TAS_UID'], $aFields['ROU_NEXT_TASK'], $aRow['ROU_TYPE']);
}
catch (Exception $oError) {
return $oError;
}
}
function deleteDerivationTest($aTestData, $aFields) {
$oProcessMap = new processMap();
try {
return $oProcessMap->deleteDerivation($aFields['TAS_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
}
//Initialize the test class (ymlTestDefinitionFile, limeTestObject, testDomain)
$oProcessMapTest = new processMapTest('processMap.yml', $t, new ymlDomain());
/*$oProcessMapTest->load('load1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('load2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oProcessMapTest->load('createProcess1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oProcessMapTest->load('updateProcess1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oProcessMapTest->load('updateProcess2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oProcessMapTest->load('editProcess1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('editProcess2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('saveTitlePosition1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('saveTitlePosition2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('steps1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('steps2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('users1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('users2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('stepsConditions1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('stepsConditions2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('stepsTriggers1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('stepsTriggers2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('addTask1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('addTask2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('editTaskProperties1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('editTaskProperties2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('saveTaskPosition1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('saveTaskPosition2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('deleteTask1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('deleteTask2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('addGuide1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('addGuide2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('saveGuidePosition1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('saveGuidePosition2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('deleteGuide1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('deleteGuide2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('deleteGuides1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('deleteGuides2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('addText1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('addText2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('updateText1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('updateText2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('saveTextPosition1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('saveTextPosition2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('deleteText1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('deleteText2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('dynaformsList1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('dynaformsList2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('outputdocsList1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('outputdocsList2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('inputdocsList1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('inputdocsList2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('triggersList1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('triggersList2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('messagesList1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('messagesList2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('currentPattern1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('currentPattern2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('newPattern1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('newPattern2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('deleteDerivation1');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;
$oProcessMapTest->load('deleteDerivation2');
$vAux = $oProcessMapTest->runSingle();
//var_dump($vAux);echo "\n\n";die;*/
?>

View File

@@ -1,247 +0,0 @@
<?php
/**
* classProcessTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
require_once( 'propel/Propel.php' );
Propel::init( PATH_CORE . "config/databases.php");
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'error');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
G::LoadSystem ( 'testTools');
require_once( PATH_CORE.'/classes/model/Process.php');
$obj = new Process ();
$t = new lime_test( 40, new lime_output_color() );
$t->diag('class Process' );
$t->isa_ok( $obj , 'Process', 'class Process created');
//method load
//#2
$t->can_ok( $obj, 'getProTitle', 'getProTitle() is callable' );
//#3
$t->can_ok( $obj, 'setProTitle', 'setProTitle() is callable' );
//#4
$t->can_ok( $obj, 'getProDescription', 'getProDescription() is callable' );
//#5
$t->can_ok( $obj, 'setProDescription', 'setProDescription() is callable' );
//#6
$t->can_ok( $obj, 'create', 'create() is callable' );
//#7
$t->can_ok( $obj, 'update', 'update() is callable' );
//#8
$t->can_ok( $obj, 'load', 'load() is callable' );
//#9
$t->can_ok( $obj, 'remove', 'remove() is callable' );
//getProUid
//#10
$t->is( $obj->getProUid(), '', 'getProUid() return empty, when the instance doesnt have any row' );
//getProTitle
try {
$obj = new Process ();
$res = $obj->getProTitle();
}
catch ( Exception $e ) {
//#11
$t->isa_ok( $e, 'Exception', 'getProTitle() return error when PRO_UID is not defined' );
//#12
$t->is ( $e->getMessage(), "Error in getProTitle, the PRO_UID can't be blank", 'getProTitle() return Error in getProTitle, the PRO_UID cant be blank' );
}
//setProDescription
try {
$obj = new Process ();
$obj->setProDescription('x');
}
catch ( Exception $e ) {
//#13
$t->isa_ok( $e, 'Exception', 'setProDescription() return error when PRO_UID is not defined' );
//#14
$t->is ( $e->getMessage(), "Error in setProDescription, the PRO_UID can't be blank", 'setProDescription() return Error in getAppTitle, the APP_UID cant be blank' );
}
//getProDescription
try {
$obj = new Process ();
$res = $obj->getProDescription();
}
catch ( Exception $e ) {
//#15
$t->isa_ok( $e, 'Exception', 'getProDescription() return error when PRO_UID is not defined' );
//#16
$t->is ( $e->getMessage(), "Error in getProDescription, the PRO_UID can't be blank", 'getProDescription() return Error in getProDescription, the PRO_UID cant be blank' );
}
//setAppDescription
try {
$obj = new Process ();
$obj->setProDescription('x');
}
catch ( Exception $e ) {
//#17
$t->isa_ok( $e, 'Exception', 'setAppDescription() return error when PRO_UID is not defined' );
//#18
$t->is ( $e->getMessage(), "Error in setProDescription, the PRO_UID can't be blank", 'setAppDescription() return Error in getAppDescription, the APP_UID cant be blank' );
}
//create new row
try {
$obj = new Process ();
$res = $obj->create();
}
catch ( Exception $e ) {
//#19
$t->isa_ok( $e, 'PropelException', 'create() return error when PRO_UID is not defined' );
//#20
$t->like ( $e->getMessage(), "%The process cannot be created. The USR_UID is empty.%", 'create() return The process cannot be created. The USR_UID is empty.' );
}
//create
try {
$Fields['USR_UID'] = '1'; // we need a valid user
$obj = new Process ();
$proUid = $obj->create( $Fields );
//#21
$t->isa_ok( $proUid, 'string', 'create(), creates a new Process' );
//#22
//$t->is ( strlen($proUid), 14, 'create(), creates a new Process, Guid lenth=14 chars' );
$t->diag ( "strlen($proUid), 14, 'create(), creates a new Process, Guid lenth=14 chars' " );
$t->is ( strlen($proUid), 32, 'create(), creates a new Process, Guid lenth=32 chars' );
$res = $obj->load( $proUid );
//#23
$t->isa_ok( $res, 'array', 'load(), loads a new Process' );
//#24
$t->is ( $res['PRO_UID'], $proUid, 'load(), loads a new Process, valid PRO_UID' );
//#25
$t->is ( strlen($res['PRO_CREATE_DATE']) ,19, 'load(), loads a new Process, valid CREATE_DATE' );
//#26
$t->like ( $res['PRO_TITLE'], '%Default Process%', 'load(), loads a new Process, valid PRO_TITLE' );
//#27
$t->is ( $res['PRO_DESCRIPTION'], 'Default Process Description', 'load(), loads a new Process, valid PRO_DESCRIPTION' );
}
catch ( Exception $e ) {
$t->like ( $e->getMessage(), "%Unable to execute INSERT statement%", 'create() return Error in getAppTitle, the APP_UID cant be blank' );
}
//update with empty
try {
$obj = new Process ();
$res = $obj->update( NULL );
}
catch ( Exception $e ) {
//#28
$t->isa_ok( $e, 'Exception', 'update() returns error when PRO_UID is not defined' );
//#29
// $t->is ( $e->getMessage(), "This row doesn't exist!", "update() This row doesn't exist!" );
$t->todo ( " $e->getMessage() This row doesn't exist! <> The row '' in table Process doesn't exist! " . " line 171");
}
//update with $fields
$newTitle = 'new title ' . rand( 1000, 5000);
$newDescription = 'new Description '. rand( 1000, 5000);
$Fields['PRO_UID'] = $proUid;
$Fields['PRO_TITLE'] = $newTitle;
$Fields['PRO_PARENT'] = rand( 1000, 5000);
$Fields['PRO_CREATE_DATE'] = 'now';
try {
$obj = new Process ();
$res = $obj->update( $Fields);
//#30
$t->is ( $res, 1, "update() update 1 row" );
$Fields = $obj->Load ( $proUid );
//#26
$t->is ( $obj->getproUid(), $proUid, "update() APP_UID = ". $proUid );
//#27
$t->is ( $obj->getProTitle(), $newTitle, "update() getAppTitle" );
//#28
$t->is ( $Fields['PRO_TITLE'], $newTitle, "update() PRO_TITLE= ". $newTitle );
//#29
$t->is ( $Fields['PRO_CREATE_DATE'], date('Y-m-d H:i:s'), "update() PRO_CREATE_DATE= ". date('Y-m-d H:i:s') );
}
catch ( Exception $e ) {
//#14
$t->isa_ok( $e, 'PropelException', 'update() return error ' . $e->getMessage() );
print $e->getMessage();
}
//remove with empty
try {
$obj = new Process ();
$res = $obj->remove( NULL );
}
catch ( Exception $e ) {
//#30
$t->isa_ok( $e, 'Exception', 'remove() returns error when UID is not defined' );
//#31
//$t->is ( $e->getMessage(), "This row doesn't exist!", "remove() This row doesn't exist!" );
$t->todo ( $e->getMessage() . " <> The row ''in table Process doesn't exist! " . " line 213" );
}
//remove with $fields
$Fields['PRO_UID'] = $proUid;
try {
$obj = new Process ();
$res = $obj->remove( $Fields );
//#32
$t->is ( $res, NULL, "remove() remove row $proUid" );
}
catch ( Exception $e ) {
//#14
$t->isa_ok( $e, 'PropelException', 'remove() return error ' . $e->getMessage() );
}
//remove with $proUid
$obj = new Process ();
$proUid = $obj->create( '1' );
try {
$obj = new Process ();
$res = $obj->remove ($proUid );
//#33
$t->is ( $res, NULL, "remove() remove row $proUid" );
}
catch ( Exception $e ) {
//#14
$t->isa_ok( $e, 'PropelException', 'remove() return error ' . $e->getMessage() );
}
$t->todo( 'Test to verify if delete works correctly :p ...');
$t->todo( 'how can I change dynamically the Case Title based in a definition, right now the case title is the same as the process title. We need another field in process to have the case title definition');
?>

View File

@@ -1,136 +0,0 @@
<?php
/**
* classRouteTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once(PATH_THIRDPARTY . '/lime/lime.php');
require_once(PATH_THIRDPARTY.'lime/yaml.class.php');
require_once(PATH_CORE . 'config/databases.php');
require_once('propel/Propel.php');
Propel::init(PATH_CORE . 'config/databases.php');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('error');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('dbtable');
G::LoadSystem('testTools');
require_once(PATH_CORE . 'classes/model/Route.php');
$obj = new Route();
$t = new lime_test(13, new lime_output_color());
$t->diag('Class Route');
//class Route
$t->isa_ok($obj, 'Route', 'Class Route created!');
//method load
$t->can_ok($obj, 'load', 'load() is callable!');
//method create
$t->can_ok($obj, 'create', 'create() is callable!');
//method update
$t->can_ok($obj, 'update', 'update() is callable!');
//method remove
$t->can_ok($obj, 'remove', 'remove() is callable!');
/***** TEST CLASS ROUTE *****/
///////// INITIAL VALUES /////////
define('SYS_LANG', 'en');
//Test class
class RouteTest extends unitTest
{
function loadTest($aTestData, $aFields)
{
$oRoute = new Route();
try {
return $oRoute->load($aFields['ROU_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function createTest($aTestData, $aFields)
{
$oRoute = new Route();
try {
return $oRoute->create($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function updateTest($aTestData, $aFields)
{
$oRoute = new Route();
try {
return $oRoute->update($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function removeTest($aTestData, $aFields)
{
$oRoute = new Route();
try {
return $oRoute->remove($aFields['ROU_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
}
//Initialize the test class (ymlTestDefinitionFile, limeTestObject, testDomain)
$oRouteTest = new RouteTest('route.yml', $t, new ymlDomain());
$oRouteTest->load('load1');
$vAux = $oRouteTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oRouteTest->load('load2');
$vAux = $oRouteTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oRouteTest->load('create1');
$vAux = $oRouteTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oRouteTest->load('create2');
$vAux = $oRouteTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oRouteTest->load('update1');
$vAux = $oRouteTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oRouteTest->load('update2');
$vAux = $oRouteTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oRouteTest->load('remove1');
$vAux = $oRouteTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oRouteTest->load('remove2');
$vAux = $oRouteTest->runSingle();
//var_dump($vAux);echo "\n\n";
?>

View File

@@ -1,132 +0,0 @@
<?php
/**
* classStepTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
require_once ( PATH_CORE . "config/databases.php");
require_once ( "propel/Propel.php" );
Propel::init( PATH_CORE . "config/databases.php");
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'error');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
G::LoadSystem ( 'dbconnection');
G::LoadSystem ( 'dbsession');
G::LoadSystem ( 'dbrecordset');
G::LoadSystem ( 'dbtable');
//G::LoadClass ( 'user');
G::LoadSystem ( 'testTools');
require_once(PATH_CORE.'/classes/model/Step.php');
require_once ( PATH_CORE . "config/databases.php");
$dbc = new DBConnection();
$ses = new DBSession( $dbc);
$obj = new Step ($dbc);
$t = new lime_test( 9, new lime_output_color() );
$t->diag('class Step' );
$t->isa_ok( $obj , 'Step', 'class Step created');
//method load
$t->can_ok( $obj, 'load', 'load() is callable' );
//method save
$t->can_ok( $obj, 'update', 'update() is callable' );
//method delete
$t->can_ok( $obj, 'delete', 'delete() is callable' );
//method create
$t->can_ok( $obj, 'create', 'create() is callable' );
class StepTest extends UnitTest
{
function CreateStep($data,$fields)
{
try
{
$Step=new Step();
$result=$Step->create($fields);
$this->domain->addDomainValue('CREATED',$Step->getStepUid());
return $result;
}
catch(Exception $e)
{
$result=array('Exception!! '=> $e->getMessage());
if(isset($e->aValidationFailures))
$result['ValidationFailures'] = $e->aValidationFailures;
return $result;
}
}
function UpdateStep($data,$fields)
{
try
{
$Step=new Step();
$result=$Step->update($fields);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function LoadStep($data,$fields)
{
try
{
$Step=new Step();
$result=$Step->load($fields['STEP_UID']);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function RemoveStep($data,$fields)
{
try
{
$Step=new Step();
$result=$Step->remove($fields['STEP_UID']);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
}
$test=new StepTest('step.yml',$t);
$test->domain->addDomain('CREATED');
$test->load('CreateTestSteps');
$test->runAll();
$test->load('StepUnitTest');
$test->runAll();

View File

@@ -1,137 +0,0 @@
<?php
/**
* classStepTriggerTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
require_once ( PATH_CORE . "config/databases.php");
require_once ( "propel/Propel.php" );
Propel::init( PATH_CORE . "config/databases.php");
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'error');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
G::LoadSystem ( 'dbconnection');
G::LoadSystem ( 'dbsession');
G::LoadSystem ( 'dbrecordset');
G::LoadSystem ( 'dbtable');
//G::LoadClass ( 'user');
G::LoadSystem ( 'testTools');
require_once(PATH_CORE.'/classes/model/StepTrigger.php');
require_once ( PATH_CORE . "config/databases.php");
$dbc = new DBConnection();
$ses = new DBSession( $dbc);
$obj = new StepTrigger ($dbc);
$t = new lime_test( 5, new lime_output_color() );
$t->diag('class StepTrigger' );
$t->isa_ok( $obj , 'StepTrigger', 'class StepTrigger created');
//method load
$t->can_ok( $obj, 'load', 'load() is callable' );
//method save
$t->can_ok( $obj, 'update', 'update() is callable' );
//method delete
$t->can_ok( $obj, 'delete', 'delete() is callable' );
//method create
$t->can_ok( $obj, 'create', 'create() is callable' );
class StepTriggerTest extends UnitTest
{
function CreateStepTrigger($data,$fields)
{
try
{
$StepTrigger=new StepTrigger();
$result=$StepTrigger->create($fields);
$this->domain->addDomainValue('CREATED',$StepTrigger->getStepUid());
$this->domain->addDomainValue('CREATED_TAS',$StepTrigger->getTasUid());
$this->domain->addDomainValue('CREATED_TRI',$StepTrigger->getTriUid());
$this->domain->addDomainValue('CREATED_TYPE',$StepTrigger->getStType());
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function UpdateStepTrigger($data,$fields)
{
try
{
$StepTrigger=new StepTrigger();
$result=$StepTrigger->update($fields);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function LoadStepTrigger($data,$fields)
{
try
{
$StepTrigger=new StepTrigger();
$result=$StepTrigger->load($fields['STEP_UID'],$fields['TAS_UID'],$fields['TRI_UID'],$fields['ST_TYPE']);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function RemoveStepTrigger($data,$fields)
{
try
{
$StepTrigger=new StepTrigger();
$result=$StepTrigger->remove($fields['STEP_UID'],$fields['TAS_UID'],$fields['TRI_UID'],$fields['ST_TYPE']);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
}
$test=new StepTriggerTest('StepTrigger.yml',$t);
/*
$this->domain->addDomainValue('CREATED');
$this->domain->addDomainValue('CREATED_TAS');
$this->domain->addDomainValue('CREATED_TRI');
$this->domain->addDomainValue('CREATED_TYPE');
*/
$test->load('CreateTestStepTriggers');
$test->runAll();
$test->load('StepTriggerUnitTest');
$test->runAll();

View File

@@ -1,142 +0,0 @@
<?php
/**
* classSwimlanesElementsTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once(PATH_THIRDPARTY . '/lime/lime.php');
require_once(PATH_THIRDPARTY.'lime/yaml.class.php');
require_once(PATH_CORE . 'config/databases.php');
require_once('propel/Propel.php');
Propel::init(PATH_CORE . 'config/databases.php');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('error');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('dbtable');
G::LoadSystem('testTools');
require_once(PATH_CORE . 'classes/model/SwimlanesElements.php');
$obj = new SwimlanesElements();
$t = new lime_test(7, new lime_output_color());
$t->diag('Class SwimlanesElements');
//class SwimlanesElements
$t->isa_ok($obj, 'SwimlanesElements', 'Class SwimlanesElements created!');
//method load
$t->can_ok($obj, 'load', 'load() is callable!');
//method create
$t->can_ok($obj, 'create', 'create() is callable!');
//method update
$t->can_ok($obj, 'update', 'update() is callable!');
//method remove
$t->can_ok($obj, 'remove', 'remove() is callable!');
//method getSwiEleText
$t->can_ok($obj, 'getSwiEleText', 'getSwiEleText() is callable!');
//method setSwiEleText
$t->can_ok($obj, 'setSwiEleText', 'setSwiEleText() is callable!');
/***** TEST CLASS SWIMLANESELEMENTS *****/
///////// INITIAL VALUES /////////
define('SYS_LANG', 'en');
//Test class
class SwimlanesElementsTest extends unitTest
{
function loadTest($aTestData, $aFields)
{
$oSwimlanesElements = new SwimlanesElements();
try {
return $oSwimlanesElements->load($aFields['SWI_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
function createTest($aTestData, $aFields)
{
$oSwimlanesElements = new SwimlanesElements();
try {
return $oSwimlanesElements->create($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function updateTest($aTestData, $aFields)
{
$oSwimlanesElements = new SwimlanesElements();
try {
return $oSwimlanesElements->update($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function removeTest($aTestData, $aFields)
{
$oSwimlanesElements = new SwimlanesElements();
try {
return $oSwimlanesElements->remove($aFields['SWI_UID']);
}
catch (Exception $oError) {
return $oError;
}
}
}
//Initialize the test class (ymlTestDefinitionFile, limeTestObject, testDomain)
$oSwimlanesElementsTest = new SwimlanesElementsTest('swimlanesElements.yml', $t, new ymlDomain());
$oSwimlanesElementsTest->load('load1');
$vAux = $oSwimlanesElementsTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oSwimlanesElementsTest->load('load2');
$vAux = $oSwimlanesElementsTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oSwimlanesElementsTest->load('create1');
$vAux = $oSwimlanesElementsTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oSwimlanesElementsTest->load('create2');
$vAux = $oSwimlanesElementsTest->runSingle();
//var_dump($vAux);echo "\n\n";*/
$oSwimlanesElementsTest->load('update1');
$vAux = $oSwimlanesElementsTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oSwimlanesElementsTest->load('update2');
$vAux = $oSwimlanesElementsTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oSwimlanesElementsTest->load('remove1');
$vAux = $oSwimlanesElementsTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oSwimlanesElementsTest->load('remove2');
$vAux = $oSwimlanesElementsTest->runSingle();
//var_dump($vAux);echo "\n\n";
?>

View File

@@ -1,132 +0,0 @@
<?php
/**
* classTaskTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
require_once ( PATH_CORE . "config/databases.php");
require_once ( "propel/Propel.php" );
Propel::init( PATH_CORE . "config/databases.php");
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'error');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
G::LoadSystem ( 'dbconnection');
G::LoadSystem ( 'dbsession');
G::LoadSystem ( 'dbrecordset');
G::LoadSystem ( 'dbtable');
G::LoadSystem ( 'testTools');
//G::LoadClass ( 'task');
require_once(PATH_CORE.'/classes/model/Task.php');
require_once ( PATH_CORE . "config/databases.php");
$dbc = new DBConnection();
$ses = new DBSession( $dbc);
$obj = new Task ($dbc);
$t = new lime_test( 11, new lime_output_color() );
$t->diag('class Task' );
$t->isa_ok( $obj , 'Task', 'class Task created');
//method load
$t->can_ok( $obj, 'load', 'load() is callable' );
//method save
$t->can_ok( $obj, 'update', 'update() is callable' );
//method delete
$t->can_ok( $obj, 'delete', 'delete() is callable' );
//method create
$t->can_ok( $obj, 'create', 'create() is callable' );
class TaskTest extends UnitTest
{
function CreateTask($data,$fields)
{
try
{
$task=new Task();
$result=$task->create($fields);
$this->domain->addDomainValue('CREATED',$task->getTasUid());
return $result;
}
catch(Exception $e)
{
$result=array('Exception!! '=> $e->getMessage());
if(isset($e->aValidationFailures))
$result['ValidationFailures'] = $e->aValidationFailures;
return $result;
}
}
function UpdateTask($data,$fields)
{
try
{
$task=new Task();
$result=$task->update($fields);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function LoadTask($data,$fields)
{
try
{
$task=new Task();
$result=$task->load($fields['TAS_UID']);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function RemoveTask($data,$fields)
{
try
{
$task=new Task();
$result=$task->remove($fields['TAS_UID']);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
}
$test=new TaskTest('task.yml',$t);
$test->domain->addDomain('CREATED');
$test->load('CreateTestTasks');
$test->runAll();
$test->load('TaskUnitTest');
$test->runAll();

View File

@@ -1,98 +0,0 @@
<?php
/**
* classTaskUserTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once(PATH_THIRDPARTY . '/lime/lime.php');
require_once(PATH_THIRDPARTY.'lime/yaml.class.php');
require_once(PATH_CORE . 'config/databases.php');
require_once('propel/Propel.php');
Propel::init(PATH_CORE . 'config/databases.php');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('error');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('dbtable');
G::LoadSystem('testTools');
require_once(PATH_CORE . 'classes/model/TaskUser.php');
$obj = new TaskUser();
$t = new lime_test(3, new lime_output_color());
$t->diag('Class TaskUser');
//class TaskUser
$t->isa_ok($obj, 'TaskUser', 'Class TaskUser created!');
//method create
$t->can_ok($obj, 'create', 'create() is callable!');
//method remove
$t->can_ok($obj, 'remove', 'remove() is callable!');
/***** TEST CLASS TASKUSER *****/
///////// INITIAL VALUES /////////
define('SYS_LANG', 'en');
//Test class
class TaskUserTest extends unitTest
{
function createTest($aTestData, $aFields)
{
$oTaskUser = new TaskUser();
try {
return $oTaskUser->create($aFields);
}
catch (Exception $oError) {
return $oError;
}
}
function removeTest($aTestData, $aFields)
{
$oTaskUser = new TaskUser();
try {
return $oTaskUser->remove($aFields['TAS_UID'], $aFields['USR_UID'], $aFields['TU_TYPE'], $aFields['TU_RELATION']);
}
catch (Exception $oError) {
return $oError;
}
}
}
//Initialize the test class (ymlTestDefinitionFile, limeTestObject, testDomain)
$oTaskUserTest = new TaskUserTest('taskUser.yml', $t, new ymlDomain());
$oTaskUserTest->load('create1');
$vAux = $oTaskUserTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oTaskUserTest->load('create2');
$vAux = $oTaskUserTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oTaskUserTest->load('remove1');
$vAux = $oTaskUserTest->runSingle();
//var_dump($vAux);echo "\n\n";
$oTaskUserTest->load('remove2');
$vAux = $oTaskUserTest->runSingle();
//var_dump($vAux);echo "\n\n";
?>

View File

@@ -1,129 +0,0 @@
<?php
/**
* classTriggerTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
require_once ( PATH_CORE . "config/databases.php");
require_once ( "propel/Propel.php" );
Propel::init( PATH_CORE . "config/databases.php");
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'error');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
G::LoadSystem ( 'dbconnection');
G::LoadSystem ( 'dbsession');
G::LoadSystem ( 'dbrecordset');
G::LoadSystem ( 'dbtable');
//G::LoadClass ( 'user');
G::LoadSystem ( 'testTools');
require_once(PATH_CORE.'/classes/model/Triggers.php');
require_once ( PATH_CORE . "config/databases.php");
$dbc = new DBConnection();
$ses = new DBSession( $dbc);
$obj = new Triggers ($dbc);
$t = new lime_test( 25, new lime_output_color() );
$t->diag('class Trigger' );
$t->isa_ok( $obj , 'Triggers', 'class Trigger created');
//method load
$t->can_ok( $obj, 'load', 'load() is callable' );
//method save
$t->can_ok( $obj, 'update', 'update() is callable' );
//method delete
$t->can_ok( $obj, 'delete', 'delete() is callable' );
//method create
$t->can_ok( $obj, 'create', 'create() is callable' );
class TriggerTest extends UnitTest
{
function CreateTrigger($data,$fields)
{
try
{
$Trigger=new Triggers();
$result=$Trigger->create($fields);
$this->domain->addDomainValue('CREATED',$Trigger->getTriUid());
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function UpdateTrigger($data,$fields)
{
try
{
$Trigger=new Triggers();
$result=$Trigger->update($fields);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function LoadTrigger($data,$fields)
{
try
{
$Trigger=new Triggers();
$result=$Trigger->load($fields['TRI_UID']);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function RemoveTrigger($data,$fields)
{
try
{
$Trigger=new Triggers();
$result=$Trigger->remove($fields['TRI_UID']);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
}
$test=new TriggerTest('trigger.yml',$t);
$test->domain->addDomain('CREATED');
$test->load('CreateTestTriggers');
$test->runAll();
$test->load('TriggerUnitTest');
$test->runAll();
?>

View File

@@ -1,132 +0,0 @@
<?php
/**
* classUserTest.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php' ;
require_once( $unitFilename );
require_once( PATH_THIRDPARTY . '/lime/lime.php');
require_once( PATH_THIRDPARTY.'lime/yaml.class.php');
require_once ( PATH_CORE . "config/databases.php");
require_once ( "propel/Propel.php" );
Propel::init( PATH_CORE . "config/databases.php");
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem ( 'error');
G::LoadSystem ( 'xmlform');
G::LoadSystem ( 'xmlDocument');
G::LoadSystem ( 'form');
G::LoadSystem ( 'dbconnection');
G::LoadSystem ( 'dbsession');
G::LoadSystem ( 'dbrecordset');
G::LoadSystem ( 'dbtable');
//G::LoadClass ( 'user');
G::LoadSystem ( 'testTools');
require_once(PATH_CORE.'/classes/model/Users.php');
require_once ( PATH_CORE . "config/databases.php");
$dbc = new DBConnection();
$ses = new DBSession( $dbc);
$obj = new Users ($dbc);
$t = new lime_test( 12, new lime_output_color() );
$t->diag('class User' );
$t->isa_ok( $obj , 'Users', 'class User created');
//method load
$t->can_ok( $obj, 'load', 'load() is callable' );
//method save
$t->can_ok( $obj, 'update', 'update() is callable' );
//method delete
$t->can_ok( $obj, 'delete', 'delete() is callable' );
//method create
$t->can_ok( $obj, 'create', 'create() is callable' );
class UserTest extends UnitTest
{
function CreateUser($data,$fields)
{
try
{
$User=new Users();
$result=$User->create($fields);
$this->domain->addDomainValue('CREATED',$User->getUsrUid());
return $result;
}
catch(Exception $e)
{
$result=array('Exception!! '=> $e->getMessage());
if(isset($e->aValidationFailures))
$result['ValidationFailures'] = $e->aValidationFailures;
return $result;
}
}
function UpdateUser($data,$fields)
{
try
{
$User=new Users();
$result=$User->update($fields);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function LoadUser($data,$fields)
{
try
{
$User=new Users();
$result=$User->load($fields['USR_UID']);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
function RemoveUser($data,$fields)
{
try
{
$User=new Users();
$result=$User->remove($fields['USR_UID']);
return $result;
}
catch(Exception $e)
{
return array('Exception!! '=> $e->getMessage());
}
}
}
$test=new UserTest('user.yml',$t);
$test->domain->addDomain('CREATED');
$test->load('CreateTestUsers');
$test->runAll();
$test->load('UserUnitTest');
$test->runAll();