[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] [18629] * New tests for ipc_calendar
From: |
Johan Gunnarsson |
Subject: |
[Phpgroupware-cvs] [18629] * New tests for ipc_calendar |
Date: |
Fri, 27 Jun 2008 20:34:32 +0000 |
Revision: 18629
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18629
Author: johang
Date: 2008-06-27 20:34:32 +0000 (Fri, 27 Jun 2008)
Log Message:
-----------
* New tests for ipc_calendar
* Reworked test data for bocalendar
Modified Paths:
--------------
trunk/calendar/test/all_test.php
trunk/calendar/test/class.bocalendar_test.inc.php
trunk/calendar/test/class.ipc_calendar_test.inc.php
Modified: trunk/calendar/test/all_test.php
===================================================================
--- trunk/calendar/test/all_test.php 2008-06-27 20:32:15 UTC (rev 18628)
+++ trunk/calendar/test/all_test.php 2008-06-27 20:34:32 UTC (rev 18629)
@@ -43,7 +43,7 @@
$GLOBALS['phpgw']->session->create(TEST_USER, md5(TEST_PASSWORD),
'md5');
$bocalendar = CreateObject('calendar.bocalendar');
- //$ipccalendar = CreateObject('calendar.ipc_calendar');
+ $ipccalendar = CreateObject('calendar.ipc_calendar');
foreach(glob("test/*_test.inc.php") as $n)
{
@@ -52,6 +52,6 @@
$group = new GroupTest('Calendar tests');
$group->addTestCase(new bocalendar_test($bocalendar));
- //$group->addTestCase(new ipc_calendar_test($ipccalendar));
+ $group->addTestCase(new ipc_calendar_test($ipccalendar));
$group->run(new TextReporter());
?>
Modified: trunk/calendar/test/class.bocalendar_test.inc.php
===================================================================
--- trunk/calendar/test/class.bocalendar_test.inc.php 2008-06-27 20:32:15 UTC
(rev 18628)
+++ trunk/calendar/test/class.bocalendar_test.inc.php 2008-06-27 20:34:32 UTC
(rev 18629)
@@ -31,7 +31,7 @@
private $sample_item = array(
'cal' => array(
- 'id' => '1000',
+ /* 'id' => '1000', */
'owner' => '8',
'reference' => '0',
'title' => 'TITLE!',
@@ -82,12 +82,8 @@
function test_save_and_get()
{
- // remove ID. we want to insert.
- $item = $this->sample_item;
- unset($item['cal']['id']);
+ $this->bocalendar->update($this->sample_item, false);
- $this->bocalendar->update($item, false);
-
$id = $GLOBALS['phpgw_info']['cal_new_event_id'];
$this->assertFalse($id === FALSE);
@@ -116,25 +112,22 @@
{
$id_list_before[] = $id;
}
-
- // remove ID. we want to insert.
- $item = $this->sample_item;
- unset($item['cal']['id']);
- $this->bocalendar->update($item, false);
+ $this->bocalendar->update($this->sample_item, false);
+
$a = $GLOBALS['phpgw_info']['cal_new_event_id'];
-
+
$this->assertTrue($a !== FALSE);
-
+
$id_list_after = array();
foreach($this->bocalendar->list_events(0, 0, 0) as $id)
{
$id_list_after[] = $id;
}
-
+
$id_list_expected_after = array_merge($id_list_before,
array($a));
-
+
sort($id_list_expected_after);
sort($id_list_after);
@@ -145,11 +138,7 @@
function test_delete()
{
- // remove ID. we want to insert.
- $item = $this->sample_item;
- unset($item['cal']['id']);
-
- $this->bocalendar->update($item, false);
+ $this->bocalendar->update($this->sample_item, false);
$id = $GLOBALS['phpgw_info']['cal_new_event_id'];
@@ -169,12 +158,10 @@
function test_exists()
{
- // insert item
- $item = $this->sample_item;
- unset($item['cal']['id']);
- $this->bocalendar->update($item, false);
+ $this->bocalendar->update($this->sample_item, false);
+
$id = $GLOBALS['phpgw_info']['cal_new_event_id'];
-
+
// make sure insert was OK
$this->assertTrue($id !== FALSE);
Modified: trunk/calendar/test/class.ipc_calendar_test.inc.php
===================================================================
--- trunk/calendar/test/class.ipc_calendar_test.inc.php 2008-06-27 20:32:15 UTC
(rev 18628)
+++ trunk/calendar/test/class.ipc_calendar_test.inc.php 2008-06-27 20:34:32 UTC
(rev 18629)
@@ -9,15 +9,15 @@
* @package calendar
* @version $Id$
*/
-
+
/*
you need simpletest in include_path to run this test case. get
it from
their site (http://simpletest.sourceforge.net/en/download.html)
or your
nearest debian or debian-like repository (php-simpletest).
*/
-
+
require_once 'simpletest/unit_tester.php';
-
+
/**
* Test ipccalendar class in calendar module.
*
@@ -26,52 +26,118 @@
class ipc_calendar_test extends UnitTestCase
{
private $ipc;
-
+
private $sample_ical;
-
- private $sample_item;
-
+
+ private $sample_item = array(
+ 'cal' => array(
+ /* 'id' => '1000', */
+ 'owner' => '8',
+ 'reference' => '0',
+ 'title' => 'TITLE!',
+ 'description' => 'DESCRIPTION!',
+ 'location' => 'LOCATION!',
+ 'priority' => '0',
+ 'recur_type' => '0',
+ 'recur_interval' => ''
+ ),
+ 'recur_exception' => '',
+ 'start' => array(
+ 'str' => '2008/06/25',
+ 'hour' => '00',
+ 'min' => '09'
+ ),
+ 'end' => array(
+ 'str' => '2008/06/25',
+ 'hour' => '00',
+ 'min' => '11'
+ ),
+ 'participants' => array(
+ '10A' /* INSERT YOUR TEST USER ID HERE */
+ ),
+ 'recur_enddate' => array(
+ 'str' => '2008/06/26'
+ )
+ );
+
function __construct($ipccalendar)
{
$this->ipc = $ipccalendar;
}
-
+
+ /**
+ * Begin each test with erasing the calendar
+ */
function setup()
{
- }
-
- function teardown()
- {
- foreach($this->to_be_deleted as $d)
+ foreach($this->ipc->getIdlist() as $d)
{
$this->ipc->removeData($d);
}
}
-
+
+ function teardown()
+ {
+ }
+
function test_addData_and_getData()
{
+ $id = $this->ipc->addData($this->sample_item,
+ 'application/x-phpgw-calendar');
+ $data = $this->ipc->getData($id,
+ 'application/x-phpgw-calendar');
+
+ $this->assertTrue($id);
+ $this->assertTrue(is_array($data));
+ $this->assertEqual($data['title'],
+ $this->sample_item['cal']['title']);
+
+ $this->to_be_deleted[] = $id;
}
-
+
function test_getIdList()
{
+ $id_list_before = $this->ipc->getIdlist();
+
+ $a = $this->ipc->addData($this->sample_item,
+ "application/x-phpgw-calendar");
+
+ $id_list_after = $this->ipc->getIdlist();
+
+ $this->assertEqual($id_list_after,
+ array_merge($id_list_before, array($a)));
+
+ $this->to_be_deleted[] = $a;
}
-
+
function test_removeData()
{
+ $id = $this->ipc->addData($this->sample_item,
+ "application/x-phpgw-calendar");
+
+ $this->assertTrue(is_array($this->ipc->getData($id,
+ "application/x-phpgw-calendar")));
+
+ $this->ipc->removeData($id);
+
+ $this->assertFalse($this->ipc->getData($id,
+ "application/x-phpgw-calendar"));
+
+ $this->to_be_deleted[] = $id;
}
-
+
function test_replaceData()
{
}
-
+
function test_existData()
{
}
-
+
function test_convertData_from_ical_1()
{
}
-
+
function test_convertData_to_ical_1()
{
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] [18629] * New tests for ipc_calendar,
Johan Gunnarsson <=