Exemplo n.º 1
0
 /**
  * Test offeredDiscountDetails works as expected when both campaigns have the same discount.
  */
 public function test_offered_discount_when_both_campaigns_have_same_discount()
 {
     $product = factory(\App\Product::class)->create(['user_id' => $this->user->id]);
     factory(\App\BillProduct::class)->create(['bill_id' => $this->billInFirstCampaign->id, 'product_id' => $product->id, 'price' => 100, 'discount' => 50, 'calculated_discount' => 50, 'final_price' => 50, 'quantity' => 1]);
     factory(\App\BillProduct::class)->create(['bill_id' => $this->billInCampaignToCompare->id, 'product_id' => $product->id, 'price' => 100, 'discount' => 50, 'calculated_discount' => 50, 'final_price' => 50, 'quantity' => 1]);
     $this->translationData['money'] = '50.00';
     $expected = ['message' => trans('statistics.offered_discount_equal_trend', $this->translationData), 'title' => trans('statistics.offered_discount_equal_trend_title'), 'discount_offered' => '50.00', 'discount_offered_in_campaign_to_compare' => '50.00'];
     $expected = array_merge($expected, $this->baseExpected);
     $this->actingAs($this->user)->assertEquals($expected, \App\Helpers\Statistics\CompareCampaignsStatistics::offeredDiscountDetails($this->firstCampaign, $this->secondCampaign));
 }