Fix & Complete tests

This commit is contained in:
Bubka
2024-07-03 11:16:08 +02:00
parent 8c89c6f0ab
commit e238e5121c
37 changed files with 1261 additions and 221 deletions

View File

@@ -6,8 +6,8 @@ use App\Http\Controllers\SystemController;
use App\Models\User;
use App\Notifications\TestEmailSettingNotification;
use App\Services\ReleaseRadarService;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Lang;
use Exception;
use Illuminate\Contracts\Notifications\Dispatcher;
use Illuminate\Support\Facades\Notification;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;
@@ -138,6 +138,21 @@ class SystemControllerTest extends FeatureTestCase
->assertForbidden();
}
#[Test]
public function test_testEmail_returns_success_even_if_sending_fails()
{
Notification::fake();
$this->mock(Dispatcher::class)->shouldReceive('send')->andThrow(new Exception());
$response = $this->actingAs($this->admin, 'web-guard')
->json('POST', '/system/test-email', []);
$response->assertStatus(200);
Notification::assertNothingSentTo($this->admin);
}
#[Test]
public function test_clearCache_returns_success()
{