/** * Call a method on each of the models, return the results as an array * * @param string $methodName * @return array */ public function invoke($methodName) { return $this->current->invoke($methodName); }
/** * @covers ::invoke */ public function testInvoke() { $source = [new City(['id' => 1]), new City(['id' => 1]), new City(['id' => 2])]; $models = new Models($source); $result = $models->invoke('getId'); $this->assertEquals([1, 1, 2], $result); }