function _sample($list, $n = 1) { return Underscore::sample($list, $n); }
/** * @dataProvider peopleDataProvider * @tags collections */ public function testSample($people, $type, $meta) { $values = [1, 2, 3, 4, 5]; // it should select 1 item from a list $this->array($values)->contains(_::sample($values))->contains(_::sample($values))->contains(_::sample($values))->contains(_::sample($values)); // it can select multiple items at a time $this->array($values)->containsValues(_::sample($values, 3)); // it can sample anything $values = _::toArray($people); $this->array($values)->containsValues(_::sample($people, 3)); }