public function test_accountPv() { /** === Test Data === */ $custId = 21; $orderId = 34; $operId = 1024; $pvTotal = 300; $accIdCust = 101; $accIdRepres = 202; /** === Setup Mocks === */ // $sale = $this->_repoSale->getById($saleId); $this->mRepoSale->shouldReceive('getById')->once()->with($orderId)->andReturn(new Sale([Sale::ATTR_TOTAL => $pvTotal])); // $customerId = $this->_repoMod->getSaleOrderCustomerId($saleId); $this->mRepoMod->shouldReceive('getSaleOrderCustomerId')->once()->with($orderId)->andReturn($custId); // $respGetAccCust = $this->_callAccount->get($reqGetAccCust); $mRespGetAccCust = new \Praxigento\Accounting\Service\Account\Response\Get(); $mRespGetAccCust->setData([Account::ATTR_ID => $accIdCust]); $this->mCallAccount->shouldReceive('get')->once()->andReturn($mRespGetAccCust); // $respGetAccRepres = $this->_callAccount->getRepresentative($reqGetAccRepres); $mRespGetAccRepres = new \Praxigento\Accounting\Service\Account\Response\GetRepresentative(); $mRespGetAccRepres->setData([Account::ATTR_ID => $accIdRepres]); $this->mCallAccount->shouldReceive('getRepresentative')->once()->andReturn($mRespGetAccRepres); // $respAddOper = $this->_callOperation->add($reqAddOper); $mRespAddOper = new \Praxigento\Accounting\Service\Operation\Response\Add(); $this->mCallOperation->shouldReceive('add')->once()->andReturn($mRespAddOper); // $operId = $respAddOper->getOperationId(); $mRespAddOper->setOperationId($operId); /** === Call and asserts === */ $req = new Request\AccountPv(); $req->setSaleOrderId($orderId); $res = $this->obj->accountPv($req); $this->assertTrue($res->isSucceed()); $operId = $res->getOperationId(); $this->assertEquals($operId, $operId); }
public function test_accountPv() { $obm = \Magento\Framework\App\ObjectManager::getInstance(); /** @var $call Call */ $call = $obm->get('Praxigento\\Pv\\Service\\Sale\\Call'); $req = new Request\AccountPv(); $req->setSaleOrderId(1); /** @var $resp Response\AccountPv */ $resp = $call->accountPv($req); $this->assertTrue($resp->isSucceed()); }