/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Integration/Support/SupportMailTest.php
55 строк
1 KB
Lucas Michot
Move Testbench-based tests to tests/Integration (#61080)
07 авг 2026, 16:42
Не верифицирован
07 авг 2026, 16:42
486d136
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Integration\Support; use Illuminate\Mail\Mailable; use Illuminate\Support\Facades\Mail; use Orchestra\Testbench\TestCase; class SupportMailTest extends TestCase { public function testItRegisterAndCallMacros() { Mail::macro('test', fn (string $str) => $str === 'foo' ? 'it works!' : 'it failed.', ); $this->assertSame('it works!', Mail::test('foo')); } public function testItRegisterAndCallMacrosWhenFaked() { Mail::macro('test', fn (string $str) => $str === 'foo' ? 'it works!' : 'it failed.', ); Mail::fake(); $this->assertSame('it works!', Mail::test('foo')); } public function testEmailSent() { Mail::fake(); Mail::assertNothingSent(); Mail::to('hello@laravel.com')->send(new TestMail()); Mail::assertSent(TestMail::class); } } class TestMail extends Mailable { /** * Build the message. * * @return $this */ public function build() { return $this->view('view'); } }