public function testTransformWithData() { $coll = new ObjectCollection(); $coll->setData(array($a = new \stdClass(), $b = new \stdClass())); $result = $this->transformer->transform($coll); $this->assertTrue(is_array($result)); $this->assertEquals(2, count($result)); $this->assertSame($a, $result[0]); $this->assertSame($b, $result[1]); }
public function reverseTransform($array) { $collection = new ObjectCollection(); if ('' === $array || null === $array) { return $collection; } if (!is_array($array)) { throw new TransformationFailedException('Expected an array.'); } $collection->setData($array); return $collection; }
protected function buildCollection($arr) { $coll = new ObjectCollection(); $coll->setData($arr); $coll->setModel('Table10'); return $coll; }