/** * This method tests the "each" method. * * @dataProvider data_each */ public function test_each(array $provided, array $expected) { $p0 = IArrayList\Type::make($provided[0], '\\Saber\\Data\\IInt32\\Type'); $e0 = $expected[0]; $e1 = 0; $this->assertInstanceOf('\\Saber\\Data\\IArrayList\\Type', $p0); $this->assertCount(count($e0), $p0->unbox()); $p1 = IArrayList\Module::each($p0, function ($x, $i) use($e0, &$e1) { $this->assertInstanceOf('\\Saber\\Data\\IInt32\\Type', $i); $this->assertSame($e1, $i->unbox()); $this->assertInstanceOf('\\Saber\\Core\\Type', $x); $this->assertSame($e0[$e1], $x->unbox()); $e1++; }); $this->assertCount($e1, $e0); $this->assertInstanceOf('\\Saber\\Data\\IArrayList\\Type', $p1); $this->assertSame($e0, $p1->unbox(1)); }