public function testTransformWithData()
 {
     $coll = new \PropelObjectCollection();
     $coll->setData(array('foo', 'bar'));
     $result = $this->transformer->transform($coll);
     $this->assertTrue(is_array($result));
     $this->assertCount(2, $result);
     $this->assertEquals('foo', $result[0]);
     $this->assertEquals('bar', $result[1]);
 }
Ejemplo n.º 2
0
 public function testSerializePropelObjectCollection()
 {
     $collection = new \PropelObjectCollection();
     $collection->setData(array(new TestSubject('lolo'), new TestSubject('pepe')));
     $json = $this->serializer->serialize($collection, 'json');
     $data = json_decode($json, true);
     $this->assertCount(2, $data);
     //will fail if PropelCollectionHandler not loaded
     foreach ($data as $testSubject) {
         $this->assertArrayHasKey('name', $testSubject);
     }
 }
 protected function buildCollection($arr)
 {
     $coll = new PropelObjectCollection();
     $coll->setData($arr);
     $coll->setModel('Table10');
     return $coll;
 }