public function test_get_createNewAccountIfMissed() { /** === Test Data === */ $assetTypeId = '12'; $custId = '21'; $accId = '34'; /** === Setup Mocks === */ // $data = $this->_repoAccount->getByCustomerId($customerId, $assetTypeId); $this->mRepoAccount->shouldReceive('getByCustomerId')->once()->andReturn([]); // $accId = $this->_repoAccount->create($data); $this->mRepoAccount->shouldReceive('create')->once()->andReturn($accId); /** === Call and asserts === */ $req = new Request\Get(); $req->setCustomerId($custId); $req->setAssetTypeId($assetTypeId); $req->setCreateNewAccountIfMissed(true); $resp = $this->obj->get($req); $this->assertTrue($resp->isSucceed()); }
private function _createAccounts() { /* create account for Customer 1 */ $custId = $this->_mapCustomerMageIdByIndex[1]; $req = new AccountGetRequest(); $req->setData(AccountGetRequest::CUSTOMER_ID, $custId); $req->setData(AccountGetRequest::ASSET_TYPE_ID, $this->typeAssetId); $req->setData(AccountGetRequest::CREATE_NEW_ACCOUNT_IF_MISSED, true); $resp = $this->_callAccount->get($req); $this->assertTrue($resp->isSucceed()); $this->acc1 = $resp->getData(); /* create account for Customer 2 */ $custId = $this->_mapCustomerMageIdByIndex[2]; $req->setData(AccountGetRequest::CUSTOMER_ID, $custId); $resp = $this->_callAccount->get($req); $this->assertTrue($resp->isSucceed()); $this->acc2 = $resp->getData(); $accFirstId = $this->acc1[Account::ATTR_ID]; $accSecondId = $this->acc2[Account::ATTR_ID]; $this->_logger->debug("2 customer accounts are created (#{$accFirstId}, #{$accSecondId})."); }