public function test_getStockId()
 {
     /** === Test Data === */
     $STOCK_ID = 54;
     $WRHS = [[Warehouse::ATTR_STOCK_REF => $STOCK_ID]];
     /** === Setup Mocks === */
     // $all = $this->_repoWrhs->get();
     $this->mRepoWrhs->shouldReceive('get')->once()->andReturn($WRHS);
     /** === Call and asserts  === */
     $this->obj->getStockId();
 }
Exemplo n.º 2
0
 /** @inheritdoc */
 public function getCurrentStock(Customer\Request\GetCurrentStock $req)
 {
     $result = new Response\GetCurrentStock();
     $custId = $req->getCustomerId();
     if (!$custId) {
         $custId = $this->_session->getCustomerId();
     }
     $link = $this->_repoCustomer->getById($custId);
     if ($link) {
         $stockId = $link->getStockRef();
     } else {
         $stockId = $this->_subRepo->getStockId();
         $data = [EntityCustomer::ATTR_CUST_REF => $custId, EntityCustomer::ATTR_STOCK_REF => $stockId];
         $this->_repoCustomer->create($data);
     }
     $result->setStockId($stockId);
     $result->markSucceed();
     return $result;
 }