Added mail to inform users about still running time entries

This commit is contained in:
Constantin Graf
2024-07-18 12:49:28 +02:00
committed by Constantin Graf
parent 855db81104
commit 8db0a7d25e
10 changed files with 347 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Mail;
use App\Mail\TimeEntryStillRunningMail;
use App\Models\TimeEntry;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\UsesClass;
use Tests\TestCaseWithDatabase;
#[CoversClass(TimeEntryStillRunningMail::class)]
#[UsesClass(TimeEntryStillRunningMail::class)]
class TimeEntryStillRunningMailTest extends TestCaseWithDatabase
{
public function test_mail_renders_content_correctly(): void
{
// Arrange
$user = $this->createUserWithPermission();
$timeEntry = TimeEntry::factory()->create([
'description' => 'TEST 123',
]);
$mail = new TimeEntryStillRunningMail($timeEntry, $user->user);
// Act
$rendered = $mail->render();
// Assert
$this->assertStringContainsString('Your currently running time entry "TEST 123"', $rendered);
}
}