Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
Increase testing coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
castarco committed Feb 16, 2017
1 parent 24bbd21 commit 49c361f
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions tests/GUID/fromHexStringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@
*/
class fromHexStringTestTest extends TestCase
{
/**
* @expectedException \Unicity\Errors\GUIDInvariantsViolationError
* @expectedExceptionMessage IDs must have at least 6 bytes of entropy
*/
public function test_too_small_expected_length()
{
GUID::fromHexString('abcd', 4);
}

/**
* @expectedException \Unicity\Errors\UnserializationError
* @expectedExceptionMessage The passed string has an unexpected length {"expected":6,"given":4}
*/
public function test_unexpected_length()
{
GUID::fromHexString('abcdef01', 6);
}

/**
* @param string $invalidHexStr
*
Expand All @@ -21,15 +39,16 @@ class fromHexStringTestTest extends TestCase
*/
public function test_invalid_hex_strings(string $invalidHexStr)
{
GUID::fromHexString($invalidHexStr, \strlen($invalidHexStr)/2);
GUID::fromHexString($invalidHexStr, (int)(\strlen($invalidHexStr)/2));
}

public function invalidHexStringsProvider()
{
return [
['xyxyxyxyxyxy'],
['abcdefABCDEF'],
['0123456789a-']
['0123456789a-'],
['0123456789abc']
];
}
}

0 comments on commit 49c361f

Please sign in to comment.