part fix for tests
This commit is contained in:
@@ -4,15 +4,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace Modules\Helpdesk\Tests\Feature;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Modules\Helpdesk\Models\Ticket;
|
||||
use Tests\TestCase;
|
||||
use Modules\Helpdesk\Tests\Concerns\BuildsHelpdeskFixtures;
|
||||
|
||||
final class TicketTimeLogTest extends TestCase
|
||||
{
|
||||
use BuildsHelpdeskFixtures;
|
||||
|
||||
use RefreshDatabase;
|
||||
|
||||
@@ -65,4 +64,35 @@ final class TicketTimeLogTest extends TestCase
|
||||
->assertRedirect(route('helpdesk.tickets.show', $ticket))
|
||||
->assertSessionHasErrors('minutes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a company for ticket time-log feature tests.
|
||||
*/
|
||||
private function createCompany(): Company
|
||||
{
|
||||
return Company::factory()->create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a company-scoped user for ticket time-log feature tests.
|
||||
*/
|
||||
private function createUserForCompany(Company $company): User
|
||||
{
|
||||
return User::factory()->create([
|
||||
'company_id' => $company->getKey(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a company-scoped ticket for ticket time-log feature tests.
|
||||
*
|
||||
* @param array<string, mixed> $attributes
|
||||
*/
|
||||
private function createTicketForCompany(Company $company, array $attributes = []): Ticket
|
||||
{
|
||||
return Ticket::factory()->create(array_merge([
|
||||
'company_id' => $company->getKey(),
|
||||
], $attributes));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user