-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
helper method for splitting time into seconds and microseconds, and u…
…se it in both places where needed
- Loading branch information
1 parent
8292f5f
commit ca1093b
Showing
4 changed files
with
54 additions
and
2 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,35 @@ | ||
<?php | ||
|
||
namespace PhpAmqpLib\Tests\Unit\Helper\Protocol; | ||
|
||
use PhpAmqpLib\Helper\MiscHelper; | ||
|
||
class MiscHelperTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @dataProvider getInputOutputForSplitSecondsMicroseconds | ||
* @param mixed $input | ||
* @param array $expected | ||
*/ | ||
public function testSplitSecondsMicroseconds($input, $expected) | ||
{ | ||
$this->assertEquals($expected, MiscHelper::splitSecondsMicroseconds($input)); | ||
} | ||
|
||
public function getInputOutputForSplitSecondsMicroseconds() | ||
{ | ||
return array( | ||
array(0, array(0, 0)), | ||
array(0.3, array(0, 300000)), | ||
array("0.3", array(0, 300000)), | ||
array(3, array(3, 0)), | ||
array("3", array(3, 0)), | ||
array(3.0, array(3, 0)), | ||
array("3.0", array(3, 0)), | ||
array(3.1, array(3, 100000)), | ||
array("3.1", array(3, 100000)), | ||
array(3.123456, array(3, 123456)), | ||
array("3.123456", array(3, 123456)), | ||
); | ||
} | ||
} |
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