-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: correct event duration * test: add unit test for getFormattedTimeDiff() in SingleEventData --------- Co-authored-by: Thor Brink <[email protected]>
- Loading branch information
1 parent
fd245dc
commit 9518ef0
Showing
2 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace EventManagerIntegration\tests\Helper; | ||
|
||
use EventManagerIntegration\Helper\SingleEventData; | ||
use WP_Mock\Tools\TestCase; | ||
|
||
class SingleEventDataTest extends TestCase { | ||
|
||
/** | ||
* @testdox getFormattedTimeDiff() should return the formatted time difference between two timestamps without rounding minutes. | ||
*/ | ||
public function testGetFormattedTimeDiff() { | ||
define('DAY_IN_SECONDS', 86400); | ||
define('HOUR_IN_SECONDS', 3600); | ||
define('MINUTE_IN_SECONDS', 60); | ||
|
||
$start = strtotime('2021-01-01 12:00:00'); | ||
$end = strtotime('2021-01-01 13:31:30'); | ||
$this->assertEquals('1 hour 31 mins', SingleEventData::getFormattedTimeDiff($start, $end)); | ||
} | ||
} |