Use strict argument validation for collections

This resolves #106
This commit is contained in:
Ben Ramsey
2020-02-23 00:50:00 -06:00
parent a8f1692b7f
commit aaccc850a1
13 changed files with 111 additions and 87 deletions
@@ -10,34 +10,6 @@ use Ramsey\Uuid\Type\Time;
class FixedTimeProviderTest extends TestCase
{
public function testConstructorRequiresSecAndUsec(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Array must contain sec and usec keys.');
new FixedTimeProvider([]);
}
public function testCurrentTimeReturnsTimestamp(): void
{
$timestamp = ['sec' => 1458844556, 'usec' => 200997];
$provider = new FixedTimeProvider($timestamp);
$this->assertEquals($timestamp, $provider->currentTime());
}
public function testCurrentTimeReturnsTimestampAfterChange(): void
{
$timestamp = ['sec' => 1458844556, 'usec' => 200997];
$provider = new FixedTimeProvider($timestamp);
$newTimestamp = ['sec' => 1050804050, 'usec' => 30192];
$provider->setSec($newTimestamp['sec']);
$provider->setUsec($newTimestamp['usec']);
$this->assertEquals($newTimestamp, $provider->currentTime());
}
public function testGetTimeReturnsTime(): void
{
$time = new Time(1458844556, 200997);