ProcessMaker "Category & Calendar (PHPUnit)"
- Category & Calendar (PHPUnit) - Small fix in Calendar
This commit is contained in:
@@ -169,7 +169,7 @@ class Calendar
|
||||
}
|
||||
|
||||
//Set variables
|
||||
$calendar = new \calendar();
|
||||
$calendar = new \CalendarDefinition();
|
||||
|
||||
$arrayTotalUsersByCalendar = $calendar->getAllCounterByCalendar("USER");
|
||||
$arrayTotalProcessesByCalendar = $calendar->getAllCounterByCalendar("PROCESS");
|
||||
|
||||
37
workflow/engine/src/Tests/BusinessModel/CalendarTest.php
Normal file
37
workflow/engine/src/Tests/BusinessModel/CalendarTest.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace Tests\BusinessModel;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
include_once (__DIR__ . "/../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class CalendarTest
|
||||
*
|
||||
* @package Tests\BusinessModel
|
||||
*/
|
||||
class CalendarTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testGetCalendars()
|
||||
{
|
||||
$calendar = new \BusinessModel\Calendar();
|
||||
|
||||
$arrayCalendar = $calendar->getCalendars();
|
||||
|
||||
$this->assertNotEmpty($arrayCalendar);
|
||||
|
||||
$arrayCalendar = $calendar->getCalendars(null, null, null, 0, 0);
|
||||
|
||||
$this->assertEmpty($arrayCalendar);
|
||||
|
||||
$arrayCalendar = $calendar->getCalendars(array("filter" => "Default"));
|
||||
|
||||
$this->assertNotEmpty($arrayCalendar);
|
||||
|
||||
$this->assertEquals($arrayCalendar[0]["CAL_UID"], "00000000000000000000000000000001");
|
||||
$this->assertEquals($arrayCalendar[0]["CAL_NAME"], "Default");
|
||||
$this->assertEquals($arrayCalendar[0]["CAL_DESCRIPTION"], "Default");
|
||||
$this->assertEquals($arrayCalendar[0]["CAL_STATUS"], "ACTIVE");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace Tests\BusinessModel;
|
||||
|
||||
if (!class_exists("Propel")) {
|
||||
include_once (__DIR__ . "/../bootstrap.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Class ProcessCategoryTest
|
||||
*
|
||||
* @package Tests\BusinessModel
|
||||
*/
|
||||
class ProcessCategoryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static $arrayUid = array();
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
foreach (self::$arrayUid as $processCategoryUid) {
|
||||
if ($processCategoryUid != "") {
|
||||
$processCategory = new \ProcessCategory();
|
||||
|
||||
$processCategory->setCategoryUid($processCategoryUid);
|
||||
$processCategory->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testCreate()
|
||||
{
|
||||
try {
|
||||
$processCategory = new \ProcessCategory();
|
||||
|
||||
$processCategoryUid = \G::GenerateUniqueID();
|
||||
|
||||
$processCategory->setNew(true);
|
||||
$processCategory->setCategoryUid($processCategoryUid);
|
||||
$processCategory->setCategoryName("PHPUnit Category");
|
||||
$processCategory->save();
|
||||
} catch (\Exception $e) {
|
||||
$processCategoryUid = "";
|
||||
}
|
||||
|
||||
self::$arrayUid[] = $processCategoryUid;
|
||||
|
||||
$this->assertNotEmpty($processCategoryUid);
|
||||
}
|
||||
|
||||
public function testGetCategories()
|
||||
{
|
||||
$processCategory = new \BusinessModel\ProcessCategory();
|
||||
|
||||
$arrayProcessCategory = $processCategory->getCategories();
|
||||
|
||||
$this->assertNotEmpty($arrayProcessCategory);
|
||||
|
||||
$arrayProcessCategory = $processCategory->getCategories(null, null, null, 0, 0);
|
||||
|
||||
$this->assertEmpty($arrayProcessCategory);
|
||||
|
||||
$arrayProcessCategory = $processCategory->getCategories(array("filter" => "PHP"));
|
||||
|
||||
$this->assertNotEmpty($arrayProcessCategory);
|
||||
|
||||
$this->assertEquals($arrayProcessCategory[0]["CAT_NAME"], "PHPUnit Category");
|
||||
$this->assertEquals($arrayProcessCategory[0]["CAT_TOTAL_PROCESSES"], 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user