public function testTransformOrder() { $this->collectionSetup(); $document1 = new Document(123, array('data' => 'lots of data'), 'type1'); $document2 = new Document(124, array('data' => 'not so much data'), 'type1'); $result1 = new POPO(123, 'lots of data'); $result2 = new POPO2(124, 'not so much data'); $this->transformers['type1']->expects($this->once())->method('transform')->with(array($document1, $document2))->will($this->returnValue(array($result1, $result2))); $results = $this->collection->transform(array($document1, $document2)); $this->assertEquals(array($result1, $result2), $results); }
public function testTransformOrderWithIdAsObject() { $this->collectionSetup(); $id1 = 'yo'; $id2 = 'lo'; $idObject1 = new IDObject($id1); $idObject2 = new IDObject($id2); $document1 = new Document($idObject1, array('data' => 'lots of data'), 'type1'); $document2 = new Document($idObject2, array('data' => 'not so much data'), 'type1'); $result1 = new POPO($idObject1, 'lots of data'); $result2 = new POPO2($idObject2, 'not so much data'); $this->transformers['type1']->expects($this->once())->method('transform')->with(array($document1, $document2))->will($this->returnValue(array($result1, $result2))); $results = $this->collection->transform(array($document1, $document2)); $this->assertEquals(array($result1, $result2), $results); }