Skip to content

Commit

Permalink
Fix tests on PHP 7.3
Browse files Browse the repository at this point in the history
When using time, PHP complains about "time() expects exactly 0 
parameters, 1 given", so use another function that PHP does not complain 
about.
  • Loading branch information
__tom__ committed Jun 27, 2019
1 parent 71eb560 commit cd9e331
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/NsplTest/FTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public function testPartial()
$oneArgFuncPartial = partial('count', [1, 2, 3]);
$this->assertEquals(3, $oneArgFuncPartial());

$noArgFuncPartial = partial('time', null);
$this->assertEquals(time(), $noArgFuncPartial(), '', 0.1);
$noArgFuncPartial = partial('locale_get_default', null);
$this->assertEquals(locale_get_default(), $noArgFuncPartial(), '', 0.1);

$sqrList = call_user_func(partial, 'array_map', function($v) { return $v * $v; });
$this->assertEquals([1, 4, 9], $sqrList([1, 2, 3]));
Expand All @@ -92,8 +92,8 @@ public function testRpartial()
$oneArgFuncPartial = rpartial('count', [1, 2, 3]);
$this->assertEquals(3, $oneArgFuncPartial());

$noArgFuncPartial = rpartial('time', null);
$this->assertEquals(time(), $noArgFuncPartial(), '', 0.1);
$noArgFuncPartial = rpartial('locale_get_default', null);
$this->assertEquals(locale_get_default(), $noArgFuncPartial(), '', 0.1);

$cube = call_user_func(rpartial, 'pow', 3);
$this->assertEquals(27, $cube(3));
Expand All @@ -109,8 +109,8 @@ public function testPpartial()
$oneArgFuncPartial = ppartial('count', array(0 => [1, 2, 3]));
$this->assertEquals(3, $oneArgFuncPartial());

$noArgFuncPartial = ppartial('time', array(0 => null));
$this->assertEquals(time(), $noArgFuncPartial(), '', 0.1);
$noArgFuncPartial = ppartial('locale_get_default', array(0 => null));
$this->assertEquals(locale_get_default(), $noArgFuncPartial());

$f = function($a, $b, $c) { return $a . $b . $c; };
$f1 = ppartial($f, array(0 => 'a'));
Expand Down

0 comments on commit cd9e331

Please sign in to comment.