Skip to content

Commit

Permalink
Fix failing unit tests, remove test cases added "for illustrative pur…
Browse files Browse the repository at this point in the history
…poses".
  • Loading branch information
paragonie-scott committed Oct 16, 2015
1 parent 7216d74 commit 9a0ce69
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ weren't for the contributions of the following individuals:
* [@asgrim (James Titcumb)](https://github.com/asgrim)
* [@CodesInChaos (Christian Winnerlein)](https://github.com/CodesInChaos)
* [@chriscct7 (Chris Christoff)](https://github.com/chriscct7)
* [@cs278 (Chris Smith)](https://github.com/cs278)
* [@cweagans (Cameron Eagans)](https://github.com/cweagans)
* [@dd32 (Dion Hulse)](https://github.com/dd32)
* [@geggleto (Glenn Eggleton)](https://github.com/geggleto)
Expand Down
2 changes: 1 addition & 1 deletion lib/cast_to_int.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ function RandomCompat_intval($number, $fail_open = false)
'Expected an integer.'
);
}
}
}
22 changes: 9 additions & 13 deletions tests/unit/UtilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,21 @@ class UtilityTest extends PHPUnit_Framework_TestCase
{
public function testStrlen()
{
$this->assertEquals(RandomCompat_strlen("\xF0\x9D\x92\xB3"), 4);

// To help illustrate the difference
if (
defined('MB_OVERLOAD_STRING') &&
ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING
) {
$this->assertTrue(
strlen("\xF0\x9D\x92\xB3") === 1
);
} else {
$this->assertTrue(
strlen("\xF0\x9D\x92\xB3") === 4
if (!function_exists('RandomCompat_strlen')) {
return $this->markTestSkipped(
'We don\' need to test this in PHP 7.'
);
}
$this->assertEquals(RandomCompat_strlen("\xF0\x9D\x92\xB3"), 4);
}

public function testIntval()
{
if (!function_exists('RandomCompat_intval')) {
return $this->markTestSkipped(
'We don\' need to test this in PHP 7.'
);
}
// Equals
$this->assertEquals(
abs(RandomCompat_intval(-4.5)),
Expand Down

0 comments on commit 9a0ce69

Please sign in to comment.