Typecast bug fix

Attempted to fix Travis CI failing unit test with typecasting
This commit is contained in:
Chris Boden 2012-02-08 17:11:10 -05:00
parent f666ed95bc
commit a4b0990961
2 changed files with 4 additions and 4 deletions

View File

@ -53,11 +53,11 @@ class Hixie76 implements VersionInterface {
}
public function generateKeyNumber($key) {
if (0 === mb_substr_count($key, ' ')) {
if (0 === substr_count($key, ' ')) {
return '';
}
$int = preg_replace('[\D]', '', $key) / mb_substr_count($key, ' ');
$int = (int)preg_replace('[\D]', '', $key) / substr_count($key, ' ');
return (is_int($int)) ? $int : '';
}

View File

@ -41,9 +41,9 @@ class Hixie76Test extends \PHPUnit_Framework_TestCase {
public static function KeyProvider() {
return array(
array('179922739', '17 9 G`ZD9 2 2b 7X 3 /r90')
array(179922739, '17 9 G`ZD9 2 2b 7X 3 /r90')
, array('', '17 9 G`ZD9 2 2b 7X 3 /r91')
, array('906585445', '3e6b263 4 17 80')
, array(906585445, '3e6b263 4 17 80')
, array('', '3e6b263 4 17 80')
, array('', '3e6b63 4 17 80')
, array('', '3e6b6341780')