Exemplo n.º 1
0
 /**
  * @tags arrays
  */
 public function testRange()
 {
     // first form (start 0 stop 5)
     $this->array(_::range(5))->hasSize(6)->isEqualTo([0, 1, 2, 3, 4, 5]);
     // second form (start 2 stop 4)
     $this->array(_::range(2, 4))->hasSize(3)->isEqualTo([2, 3, 4]);
     // thrid form (start -1 stop 1 step 2)
     $this->array(_::range(-1, 1, 2))->hasSize(2)->isEqualTo([-1, 1]);
 }
function _range($start, $stop = NULL, $step = 1)
{
    return Underscore::range($start, $stop, $step);
}
Exemplo n.º 3
0
 /**
  * @dataProvider getTestRangeData
  */
 public function testRange($start, $stop, $step, $expected, $exception = null)
 {
     $exception && $this->setExpectedException($exception);
     $this->assertEquals($expected, Underscore::range($start, $stop, $step)->toArray());
 }