summaryrefslogtreecommitdiff
path: root/tests/Unit/Helpers/Schedule/CalculatesTimeTest.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2019-11-27 23:43:21 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2019-12-08 02:20:48 +0100
commit42721e95726559b4a601240bb5b0fe4e5d755b2a (patch)
tree6810e05f845ca787acc1d02fa82d3df15cd0ef9b /tests/Unit/Helpers/Schedule/CalculatesTimeTest.php
parent377b390c97afb9106fd9a139819d00306f996f24 (diff)
Added Schedule parsing and replaced old Fahrplan importer
Resolves #553 (Change Frab Import from xCal to XML) Resolves #538 (Feature Request: Multi Frab Import)
Diffstat (limited to 'tests/Unit/Helpers/Schedule/CalculatesTimeTest.php')
-rw-r--r--tests/Unit/Helpers/Schedule/CalculatesTimeTest.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/Unit/Helpers/Schedule/CalculatesTimeTest.php b/tests/Unit/Helpers/Schedule/CalculatesTimeTest.php
new file mode 100644
index 00000000..8f0123e9
--- /dev/null
+++ b/tests/Unit/Helpers/Schedule/CalculatesTimeTest.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace Engelsystem\Test\Unit\Helpers\Schedule;
+
+use Engelsystem\Helpers\Schedule\CalculatesTime;
+use Engelsystem\Test\Unit\TestCase;
+
+class CalculatesTimeTest extends TestCase
+{
+ /**
+ * @covers \Engelsystem\Helpers\Schedule\CalculatesTime::secondsFromTime
+ */
+ public function testSecondsFromTime()
+ {
+ $calc = new class {
+ use CalculatesTime;
+
+ /**
+ * @param string $time
+ * @return int
+ */
+ public function calc(string $time): int
+ {
+ return $this->secondsFromTime($time);
+ }
+ };
+
+ $this->assertEquals(0, $calc->calc('0:00'));
+ $this->assertEquals(60, $calc->calc('0:01'));
+ $this->assertEquals(60 * 60, $calc->calc('01:00'));
+ $this->assertEquals(60 * 60 * 10 + 60 * 11, $calc->calc('10:11'));
+ }
+}