public function test_getLotsByProductId() { /** === Test Data === */ $PROD_ID = 32; $STOCK_ID = 54; /** === Setup Mocks === */ // $conn = $this->_repoGeneric->getConnection(); $mConn = $this->_mockConn(['fetchAll']); $this->mRepoGeneric->shouldReceive('getConnection')->once()->andReturn($mConn); // $tblStockItem = [$asStockItem => $this->_resource->getTableName(Cfg::ENTITY_MAGE_CATALOGINVENTORY_STOCK_ITEM)]; // $tblQty = [$asQty => $this->_resource->getTableName(Quantity::ENTITY_NAME)]; // $tblLot = [$asLot => $this->_resource->getTableName(Lot::ENTITY_NAME)]; $this->mResource->shouldReceive('getTableName')->times(3)->andReturn('table name'); // $query = $conn->select(); $mQuery = $this->_mockDbSelect(['from', 'joinLeft', 'where', 'order']); $mConn->shouldReceive('select')->once()->andReturn($mQuery); /** === Call and asserts === */ $this->obj->getLotsByProductId($PROD_ID, $STOCK_ID); }