ShopTestBench.php 466 B

123456789101112131415161718192021
  1. <?php
  2. namespace Webkul\Shop\Tests\Concerns;
  3. use Webkul\Customer\Contracts\Customer as CustomerContract;
  4. use Webkul\Faker\Helpers\Customer as CustomerFaker;
  5. trait ShopTestBench
  6. {
  7. /**
  8. * Login as customer.
  9. */
  10. public function loginAsCustomer(?CustomerContract $customer = null): CustomerContract
  11. {
  12. $customer = $customer ?? (new CustomerFaker)->factory()->create();
  13. $this->actingAs($customer);
  14. return $customer;
  15. }
  16. }