예제 #1
0
 public function testGetChildrenIds()
 {
     //prepare mocks and data
     $parentId = 100;
     $typeId = 4;
     $bind = [':product_id' => $parentId, ':link_type_id' => $typeId];
     $fetchedData = [['linked_product_id' => 100], ['linked_product_id' => 500]];
     $result = [$typeId => [100 => 100, 500 => 500]];
     // method flow
     $this->prepareReadAdapter();
     $this->dbSelect->expects($this->once())->method('from')->will($this->returnValue($this->dbSelect));
     $this->dbSelect->expects($this->atLeastOnce())->method('where')->will($this->returnValue($this->dbSelect));
     $this->readAdapter->expects($this->once())->method('fetchAll')->with($this->dbSelect, $bind)->will($this->returnValue($fetchedData));
     $this->assertEquals($result, $this->model->getChildrenIds($parentId, $typeId));
 }