/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Integration/Mail/MailableTestCase.php
72 строки
2 KB
Mior Muhammad Zaki
[11.x] Test Improvements (#55549)
25 апр 2025, 16:28
Не верифицирован
25 апр 2025, 16:28
401649c
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Integration\Mail; use Illuminate\Mail\Mailable; use Illuminate\Mail\Mailables\Content; use Illuminate\Mail\Mailables\Envelope; use Orchestra\Testbench\TestCase; use PHPUnit\Framework\Attributes\DataProvider; abstract class MailableTestCase extends TestCase { /** {@inheritdoc} */ #[\Override] protected function defineEnvironment($app) { $app['view']->addLocation(__DIR__.'/Fixtures'); } #[DataProvider('markdownEncodedDataProvider')] public function testItCanAssertMarkdownEncodedString($given, $expected) { $mailable = new class($given) extends Mailable { public function __construct(public string $message) { // } public function envelope() { return new Envelope( subject: 'My basic title', ); } public function content() { return new Content( markdown: 'message', ); } }; $mailable->assertSeeInHtml($expected, false); } public static function markdownEncodedDataProvider() { yield ['[Laravel](https://laravel.com)', 'My message is: [Laravel](https://laravel.com)']; yield [ '', 'My message is: ', ]; yield [ 'Visit https://laravel.com/docs to browse the documentation', 'My message is: Visit https://laravel.com/docs to browse the documentation', ]; yield [ 'Visit <https://laravel.com/docs> to browse the documentation', 'My message is: Visit <https://laravel.com/docs> to browse the documentation', ]; yield [ 'Visit <span>https://laravel.com/docs</span> to browse the documentation', 'My message is: Visit <span>https://laravel.com/docs</span> to browse the documentation', ]; } }