public function testMin() { // from js $this->assertEquals(1, __u::min(array(1, 2, 3)), 'can perform a regular min'); $this->assertEquals(3, __u::min(array(1, 2, 3), function ($num) { return -$num; }), 'can performa a computation-based max'); // extra $stooges = array(array('name' => 'moe', 'age' => 40), array('name' => 'larry', 'age' => 50), array('name' => 'curly', 'age' => 60)); $this->assertEquals($stooges[0], __u::min($stooges, function ($stooge) { return $stooge['age']; })); $this->assertEquals($stooges[2], __u::min($stooges, function ($stooge) { return $stooge['name']; })); $this->assertEquals($stooges[2], __u($stooges)->min(function ($stooge) { return $stooge['name']; }), 'works with OO-style call'); // docs $stooges = array(array('name' => 'moe', 'age' => 40), array('name' => 'larry', 'age' => 50), array('name' => 'curly', 'age' => 60)); $this->assertEquals(array('name' => 'moe', 'age' => 40), __u::min($stooges, function ($stooge) { return $stooge['age']; })); }