Example #1
0
 public function testCreateMinimalTask()
 {
     $summary = 'minimal task by phpunit';
     $task = new Tasks_Model_Task(array('summary' => $summary, 'container_id' => $this->container_id));
     $persitantTask = $this->_backend->create($task);
     $pagination = new Tasks_Model_Pagination();
     $filter = new Tasks_Model_TaskFilter(array(array('field' => 'summary', 'operator' => 'contains', 'value' => $summary), array('field' => 'container_id', 'operator' => 'equals', 'value' => $task->container_id)));
     $tasks = $this->_backend->search($filter, $pagination);
     $this->assertEquals(1, count($tasks));
     $db = new Tinebase_Db_Table(array('name' => SQL_TABLE_PREFIX . 'tasks'));
     $db->delete("summary LIKE '{$summary}'");
     Tinebase_Timemachine_ModificationLogTest::purgeLogs($persitantTask->getId());
 }
            }
            $this->assertEquals($params['nums'], $count);
        }
    }
    /**
     * purges mod log entries of given recordIds
     *
     * @param mixed [string|array|Tinebase_Record_RecordSet] $_recordIds
     */
    public static function purgeLogs($_recordIds)
    {
        $table = new Tinebase_Db_Table(array('name' => SQL_TABLE_PREFIX . 'timemachine_modlog'));
        foreach ((array) $_recordIds as $recordId) {
            $table->delete($table->getAdapter()->quoteInto('record_id = ?', $recordId));
        }
    }
    /**
     * Workaround as the php clone operator does not return cloned 
     * objects right hand sided
     *
     * @param object $_object
     * @return object
     */
    protected function Cloner($_object)
    {
        return clone $_object;
    }
}
if (PHPUnit_MAIN_METHOD == 'Tinebase_Timemachine_ModificationLogTest::main') {
    Tinebase_Timemachine_ModificationLogTest::main();
}