@@ -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');
|
||||
@@ -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();
|
||||
|
||||
?>
|
||||
@@ -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";
|
||||
?>
|
||||
@@ -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');
|
||||
|
||||
?>
|
||||
|
||||
@@ -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();
|
||||
@@ -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.' );
|
||||
@@ -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();
|
||||
@@ -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' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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' );
|
||||
}
|
||||
@@ -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";
|
||||
?>
|
||||
@@ -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');
|
||||
@@ -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";
|
||||
?>
|
||||
@@ -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";
|
||||
?>
|
||||
@@ -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;*/
|
||||
?>
|
||||
@@ -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');
|
||||
|
||||
?>
|
||||
@@ -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";
|
||||
?>
|
||||
@@ -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();
|
||||
@@ -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();
|
||||
@@ -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";
|
||||
?>
|
||||
@@ -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();
|
||||
@@ -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";
|
||||
?>
|
||||
@@ -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();
|
||||
?>
|
||||
@@ -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();
|
||||
Reference in New Issue
Block a user