better durations support (months)

This commit is contained in:
DavidBadura
2015-05-15 11:38:38 +00:00
parent b31a76ef9a
commit 624435017b
3 changed files with 148 additions and 18 deletions

View File

@@ -10,29 +10,129 @@ use DavidBadura\Taskwarrior\Recurring;
class RecurringTest extends \PHPUnit_Framework_TestCase
{
/**
* @see http://taskwarrior.org/docs/durations.html
* @return array
*/
public function validData()
{
return [
['5 seconds'],
['5 second'],
['5 secs'],
['5 sec'],
['5 s'],
['5seconds'],
['5second'],
['5secs'],
['5sec'],
['5s'],
['second'],
['sec'],
['5 minutes'],
['5 minute'],
['5 mins'],
['5 min'],
['5minutes'],
['5minute'],
['5mins'],
['5min'],
['minute'],
['min'],
['3 hours'],
['3 hour'],
['3 hrs'],
['3 hr'],
['3 h'],
['3hours'],
['3hour'],
['3hrs'],
['3hr'],
['3h'],
['hour'],
['hr'],
['2 days'],
['2 day'],
['2 d'],
['2days'],
['2day'],
['2d'],
['daily'],
['weekdays'],
['day'],
['3 weeks'],
['3 week'],
['3 wks'],
['3 wk'],
['3 w'],
['3weeks'],
['3week'],
['3wks'],
['3wk'],
['3w'],
['weekly'],
['week'],
['wk'],
['weekdays'],
['2 fortnight'],
['2 sennight'],
['2fortnight'],
['2sennight'],
['biweekly'],
['fortnight'],
['sennight'],
['5 months'],
['5 month'],
['5 mnths'],
['5 mths'],
['5 mth'],
['5 mo'],
['5 m'],
['5months'],
['5month'],
['5mnths'],
['5mths'],
['5mth'],
['5mo'],
['5m'],
['monthly'],
['month'],
['mth'],
['mo'],
['bimonthly'],
['1 quarterly'],
['1 quarters'],
['1 quarter'],
['1 qrtrs'],
['1 qrtr'],
['1 qtr'],
['1 q'],
['1quarterly'],
['1quarters'],
['1quarter'],
['1qrtrs'],
['1qrtr'],
['1qtr'],
['1q'],
['quarterly'],
['quarter'],
['qrtr'],
['qtr'],
['semiannual'],
['1 years'],
['1 year'],
['1 yrs'],
['1 yr'],
['1 y'],
['1years'],
['1year'],
['1yrs'],
['1yr'],
['1y'],
['annual'],
['yearly'],
['year'],
['yr'],
['biannual'],
['biyearly'],
['2d'],
['12d'],
['2w'],
['12w'],
['2q'],
['12q'],
['2y'],
['12y']
['biyearly']
];
}
@@ -56,8 +156,7 @@ class RecurringTest extends \PHPUnit_Framework_TestCase
['foo'],
['weekday'],
['2x'],
['a2w'],
['d']
['a2w']
];
}
@@ -69,6 +168,6 @@ class RecurringTest extends \PHPUnit_Framework_TestCase
{
$this->setExpectedException('DavidBadura\Taskwarrior\Exception\RecurringParseException');
$obj = new Recurring($recur);
new Recurring($recur);
}
}