public function __construct(DTO $dto) { $this->dto = $dto; $this->data = $dto->getData(); }
public function testNestedArrayLoopsWithDTOObjects() { $arr = DTO::make(['first' => ['name' => 'Sahan'], 'second']); $return = []; foreach ($arr as $index => $value) { $return[$index] = $value; } $this->assertInstanceOf('SH\\SimpleDTO\\DTO', $return['first']); $this->assertSame('Sahan', $return['first']->name); $this->assertSame('second', $return[0]); }