Exemplo n.º 1
0
 /**
  * @dataProvider nonEmptySubjectProvider
  * @coversNothing
  */
 public function test_reduceRight_callback(testSubject $subject)
 {
     $ran = 1;
     // there should be one less iteration than length
     $head = $subject->reverse()->head();
     $subject->reduceRight(function () use($subject, $head, &$ran) {
         self::assertEquals(4, func_num_args());
         list($a, $v, $k, $t) = func_get_args();
         self::assertSame($head, $a);
         self::assertSame($subject->offsetGet($k), $v);
         self::assertTrue(is_int($k) || is_string($k));
         self::assertSame($subject, $t);
         $ran += 1;
         return $a;
     });
     self::assertEquals(count($subject), $ran);
 }