update recurring

This commit is contained in:
DavidBadura 2015-02-08 13:29:44 +00:00
parent fb3da0face
commit 6d13ee7d3a
5 changed files with 11 additions and 11 deletions

View File

@ -14,10 +14,10 @@ $tm = TaskManager::create();
$task = new Task();
$task->setDescription('program this lib');
$task->setProject('hobby');
$task->setDue(new \DateTime('tomorrow'));
$task->setDue('tomorrow');
$task->setPriority(Task::PRIORITY_HIGH);
$task->addTag('next');
$task->setRecur(new Recurring(Recurring::DAILY));
$task->setRecurring(Recurring::DAILY);
$tm->save($task);

View File

@ -32,7 +32,7 @@ class Recurring
*/
public function __construct($recurring)
{
if ($this->isValid($recurring)) {
if (self::isValid($recurring)) {
$this->recurring = $recurring;
} else {
throw new TaskwarriorException();
@ -51,7 +51,7 @@ class Recurring
* @param string $recur
* @return bool
*/
private function isValid($recur)
public static function isValid($recur)
{
$refClass = new \ReflectionClass(__CLASS__);
$constants = $refClass->getConstants();

View File

@ -263,7 +263,7 @@ class Task
/**
* @return string
*/
public function getRecur()
public function getRecurring()
{
return $this->recur;
}
@ -272,7 +272,7 @@ class Task
* @param string|Recurring $recur
* @throws TaskwarriorException
*/
public function setRecur($recur)
public function setRecurring($recur)
{
if (is_string($recur)) {
$this->recur = new Recurring($recur);

View File

@ -264,10 +264,10 @@ class TaskManager
*/
private function setValue(Task $task, $attr, $value)
{
$reflectionClass = new \ReflectionClass('DavidBadura\Taskwarrior\Task');
$prop = $reflectionClass->getProperty($attr);
$prop->setAccessible(true);
$prop->setValue($task, $value);
$refClass = new \ReflectionClass('DavidBadura\Taskwarrior\Task');
$refProp = $refClass->getProperty($attr);
$refProp->setAccessible(true);
$refProp->setValue($task, $value);
}
/**

View File

@ -512,7 +512,7 @@ class TaskManagerTest extends \PHPUnit_Framework_TestCase
$task1 = new Task();
$task1->setDescription('foo1');
$task1->setDue('tomorrow');
$task1->setRecur('daily');
$task1->setRecurring('daily');
$this->taskManager->save($task1);