Taskwarrior/tests/RecurringTest.php

74 lines
1.4 KiB
PHP
Raw Normal View History

2015-02-08 07:00:15 -06:00
<?php
namespace DavidBadura\Taskwarrior\Test;
use DavidBadura\Taskwarrior\Recurring;
/**
* @author David Badura <badura@simplethings.de>
*/
class RecurringTest extends \PHPUnit_Framework_TestCase
{
/**
* @return array
*/
public function validData()
{
return [
['daily'],
['weekdays'],
['weekly'],
['biweekly'],
['quarterly'],
['semiannual'],
['annual'],
['yearly'],
['biannual'],
['biyearly'],
['2d'],
['12d'],
['2w'],
['12w'],
['2q'],
['12q'],
['2y'],
['12y']
];
}
/**
* @dataProvider validData
* @param $recur
*/
public function testValid($recur)
{
$this->assertEquals($recur, (string)new Recurring($recur));
}
/**
* @return array
*/
public function invalidData()
{
return [
['dailya'],
['asdasd'],
['foo'],
['weekday'],
['2x'],
['a2w'],
['d']
];
}
/**
* @dataProvider invalidData
* @param $recur
*/
public function testInvalid($recur)
{
2015-04-06 16:13:02 -05:00
$this->setExpectedException('DavidBadura\Taskwarrior\Exception\RecurringParseException');
2015-02-08 07:00:15 -06:00
$obj = new Recurring($recur);
}
}