Browse Source

Add test for Strings::isHex()

pull/7207/head
Philipp Holzer 2 years ago
parent
commit
0115329dc6
No known key found for this signature in database GPG Key ID: D8365C3D36B77D90
  1. 35
      tests/src/Util/StringsTest.php

35
tests/src/Util/StringsTest.php

@ -82,4 +82,39 @@ class StringsTest extends TestCase
$escapedString
);
}
public function dataIsHex()
{
return [
'validHex' => [
'input' => '90913473615bf00c122ac78338492980',
'valid' => true,
],
'invalidHex' => [
'input' => '90913473615bf00c122ac7833849293',
'valid' => false,
],
'emptyHex' => [
'input' => '',
'valid' => false,
],
'nullHex' => [
'input' => null,
'valid' => false,
],
];
}
/**
* Tests if the string is a valid hexadecimal value
*
* @param string $input
* @param bool $valid
*
* @dataProvider dataIsHex
*/
public function testIsHex($input, $valid)
{
$this->assertEquals($valid, Strings::isHex($input));
}
}
Loading…
Cancel
Save