fixing arrow function (not available in 7.3)

This commit is contained in:
Benjamin Delespierre 2020-08-23 21:38:19 +02:00
parent cdd6636b7b
commit 5108b2ca4f
2 changed files with 12 additions and 4 deletions

View File

@ -35,7 +35,9 @@ class ClusterTest extends TestCase
[ [
'centroid' => $points[0]->toArray(), 'centroid' => $points[0]->toArray(),
'points' => array_map( 'points' => array_map(
fn($p) => $p->toArray(), function ($p) {
return $p->toArray();
},
$points $points
), ),
], ],

View File

@ -41,7 +41,9 @@ class SpaceTest extends TestCase
} }
$this->assertEquals( $this->assertEquals(
['points' => array_map(fn($p) => $p->toArray(), $points)], ['points' => array_map(function ($p) {
return $p->toArray();
}, $points)],
$space->toArray() $space->toArray()
); );
} }
@ -119,10 +121,14 @@ class SpaceTest extends TestCase
$min = new Point($space, [0]); $min = new Point($space, [0]);
$max = new Point($space, [10]); $max = new Point($space, [10]);
Space::setRng(fn($min, $max) => $min); Space::setRng(function ($min, $max) {
return $min;
});
$this->assertEquals($min, $space->getRandomPoint($min, $max)); $this->assertEquals($min, $space->getRandomPoint($min, $max));
Space::setRng(fn($min, $max) => $max); Space::setRng(function ($min, $max) {
return $max;
});
$this->assertEquals($max, $space->getRandomPoint($min, $max)); $this->assertEquals($max, $space->getRandomPoint($min, $max));
} }