ResetCustomersCommandTest.php 818 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace Webkul\BagistoApi\Tests\Unit\Migration;
  3. use Illuminate\Support\Facades\Schema;
  4. use Webkul\BagistoApi\Tests\BagistoApiTestCase;
  5. use Webkul\Customer\Models\Customer;
  6. class ResetCustomersCommandTest extends BagistoApiTestCase
  7. {
  8. public function setUp(): void
  9. {
  10. parent::setUp();
  11. if (! Schema::hasTable('customers') || ! Schema::hasTable('customer_groups')) {
  12. $this->markTestSkipped('Customer tables are missing.');
  13. }
  14. $this->seedRequiredData();
  15. }
  16. public function test_dry_run_does_not_delete_customers(): void
  17. {
  18. $customer = $this->createCustomer();
  19. $this->artisan('customers:reset', ['--dry-run' => true])
  20. ->assertSuccessful();
  21. $this->assertDatabaseHas('customers', ['id' => $customer->id]);
  22. }
  23. }