Created
October 16, 2017 02:45
-
-
Save jsdecena/820725bbfbb4f98098290ec42e3b72ee to your computer and use it in GitHub Desktop.
Laracom order edit unit test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @test */ | |
public function it_can_update_the_order() | |
{ | |
$order = factory(Order::class)->create(); | |
$orderRepo = new OrderRepository($order); | |
$customer = factory(Customer::class)->create(); | |
$courier = factory(Courier::class)->create(); | |
$address = factory(Address::class)->create(); | |
$orderStatus = factory(OrderStatus::class)->create(); | |
$paymentMethod = factory(PaymentMethod::class)->create(); | |
$update = [ | |
'reference' => $this->faker->uuid, | |
'courier_id' => $courier->id, | |
'customer_id' => $customer->id, | |
'address_id' => $address->id, | |
'order_status_id' => $orderStatus->id, | |
'payment_method_id' => $paymentMethod->id, | |
'discounts' => 10.50, | |
'total_products' => 100, | |
'tax' => 10.00, | |
'total' => 100.00, | |
'total_paid' => 100, | |
'invoice' => null, | |
'tracking_no' => $this->faker->uuid, // add this | |
'bc_no' => $this->faker->uuid // add this | |
]; | |
$updated = $orderRepo->updateOrder($update); | |
$this->assertEquals($update['reference'], $updated->reference); | |
$this->assertEquals($update['discounts'], $updated->discounts); | |
$this->assertEquals($update['total_products'], $updated->total_products); | |
$this->assertEquals($update['total_paid'], $updated->total_paid); | |
$this->assertEquals($update['invoice'], $updated->invoice); | |
$this->assertEquals($update['tracking_no'], $updated->tracking_no); // add this | |
$this->assertEquals($update['bc_no'], $updated->bc_no); // add this | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment