CluPilotCloud/tests/Feature/Console/CreateAdminTest.php

16 lines
594 B
PHP

<?php
use App\Models\Operator;
use App\Models\User;
it('will not create an operator from an orphaned portal login', function () {
// A users row with no matching customers row — Customer::where('email',
// ...) alone cannot see this identity; it still lives in `users`.
User::factory()->create(['email' => 'orphan-cli@ops.test']);
$this->artisan('clupilot:create-operator --email=orphan-cli@ops.test --name=Orphan --password=a-strong-password-123')
->assertFailed();
expect(Operator::query()->where('email', 'orphan-cli@ops.test')->exists())->toBeFalse();
});