SHARE
TWEET

Untitled

a guest Nov 14th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public function processReclaim()
  2.     {
  3.         $requestParams = [
  4.             'reclam_id' => 899,
  5.             'status' => 'accepted',
  6.             'article_1367' => 14
  7.         ];
  8.         $data = [
  9.             'reclaim_detail' => [[
  10.                 'reclamation_detail_id' => 1367,
  11.                 'approved_amount' => 1
  12.             ]],
  13.             'reclaim_id' => 899,
  14.             'user_id' => 2,
  15.             'comment' => ''];
  16.         $request = new \Illuminate\Http\Request();
  17.         $request->setMethod('POST');
  18.         $request->request->add($requestParams);
  19.         $user = factory(\App\Models\User::class)->create()->assignRole(['Super Admin']);
  20.         $request->setUserResolver(function () use ($user) {
  21.             return $user;
  22.         });
  23.         $mock = \Mockery::mock(ReclaimsService::class)->makePartial();
  24.         $mock->shouldReceive('reclaimStatus')->with("/Reclaim/approve/admin", ['json' => $data], $user->country, [])->andReturn(200);
  25.         $mock->reclaimStatus($request);
  26. }
  27.  
  28.     public function reclaimStatus($request){
  29.  
  30.         $data = $this->makeRequestData($request);
  31.  
  32.         if ($request->user()->hasRole('KAM Admin')) {
  33.             $this->post("/Reclaim/approve/kam", ['json' => $data], $request->user()->country);
  34.         } else if ($request->user()->hasRole('RP Admin')) {
  35.             $this->post("/Reclaim/approve/rp", ['json' => $data], $request->user()->country);
  36.         } else {
  37.             $this->post("/Reclaim/approve/admin", ['json' => $data], $request->user()->country);
  38.         }
  39.  
  40.         flash()->success(__('myphoenix.reclaim_flash_updated'));
  41.  
  42.         $this->activity(null, $request->user()->id, 'accepted', $data);
  43.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top