diff --git a/tests/Phue/Test/TimePattern/AbsoluteTimeTest.php b/tests/Phue/Test/TimePattern/AbsoluteTimeTest.php new file mode 100644 index 0000000..0d20edc --- /dev/null +++ b/tests/Phue/Test/TimePattern/AbsoluteTimeTest.php @@ -0,0 +1,31 @@ + + * @copyright Copyright (c) 2012-2014 Michael K. Squires + * @license http://github.com/sqmk/Phue/wiki/License + */ + +namespace Phue\Test\TimePattern; + +use Phue\TimePattern\AbsoluteTime; + +/** + * Tests for Phue\TimePattern\AbsoluteTime + */ +class AbsoluteTimeTest extends \PHPUnit_Framework_TestCase +{ + /** + * Test: Creating absolute time + * + * @covers \Phue\TimePattern\AbsoluteTime + */ + public function testCreateTime() + { + $this->assertRegExp( + '/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/', + (string) new AbsoluteTime('now') + ); + } +} diff --git a/tests/Phue/Test/TimePattern/RandomizedTimeTest.php b/tests/Phue/Test/TimePattern/RandomizedTimeTest.php new file mode 100644 index 0000000..65f08e6 --- /dev/null +++ b/tests/Phue/Test/TimePattern/RandomizedTimeTest.php @@ -0,0 +1,31 @@ + + * @copyright Copyright (c) 2012-2014 Michael K. Squires + * @license http://github.com/sqmk/Phue/wiki/License + */ + +namespace Phue\Test\TimePattern; + +use Phue\TimePattern\RandomizedTime; + +/** + * Tests for Phue\TimePattern\RandomizedTime + */ +class RandomizedTimeTest extends \PHPUnit_Framework_TestCase +{ + /** + * Test: Creating randomized time + * + * @covers \Phue\TimePattern\RandomizedTime + */ + public function testCreateTime() + { + $this->assertRegExp( + '/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}A01:01:20$/', + (string) new RandomizedTime('now', 3680) + ); + } +} diff --git a/tests/Phue/Test/TimePattern/RecurringTimeTest.php b/tests/Phue/Test/TimePattern/RecurringTimeTest.php new file mode 100644 index 0000000..42de651 --- /dev/null +++ b/tests/Phue/Test/TimePattern/RecurringTimeTest.php @@ -0,0 +1,33 @@ + + * @copyright Copyright (c) 2012-2014 Michael K. Squires + * @license http://github.com/sqmk/Phue/wiki/License + */ + +namespace Phue\Test\TimePattern; + +use Phue\TimePattern\RecurringTime; + +/** + * Tests for Phue\TimePattern\RecurringTime + */ +class RecurringTimeTest extends \PHPUnit_Framework_TestCase +{ + /** + * Test: Creating recurring time + * + * @covers \Phue\TimePattern\RecurringTime + */ + public function testCreateTime() + { + $this->assertRegExp( + '/^W34\/T14:02:05$/', + (string) new RecurringTime( + RecurringTime::TUESDAY | RecurringTime::SATURDAY, 14, 2, 5 + ) + ); + } +} diff --git a/tests/Phue/Test/TimePattern/TimerTest.php b/tests/Phue/Test/TimePattern/TimerTest.php new file mode 100644 index 0000000..47ff360 --- /dev/null +++ b/tests/Phue/Test/TimePattern/TimerTest.php @@ -0,0 +1,31 @@ + + * @copyright Copyright (c) 2012-2014 Michael K. Squires + * @license http://github.com/sqmk/Phue/wiki/License + */ + +namespace Phue\Test\TimePattern; + +use Phue\TimePattern\Timer; + +/** + * Tests for Phue\TimePattern\Timer + */ +class TimerTest extends \PHPUnit_Framework_TestCase +{ + /** + * Test: Creating recurring time + * + * @covers \Phue\TimePattern\Timer + */ + public function testCreateTime() + { + $this->assertRegExp( + '/^R12\/PT01:05:25$/', + (string) (new Timer(3925))->repeat(12) + ); + } +}