/
githubmirror
/
symfony
Обзор
Документация
Войти
/
githubmirror
/
symfony
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
8.2
src/Symfony/Component/Notifier/Tests/Recipient/RecipientTest.php
60 строк
2 KB
Christian Flothmann
replace PHPUnit annotations with attributes
04 авг 2025, 10:05
04 авг 2025, 10:05
982f89c
Код
Авторство
О чём код?
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Notifier\Tests\Recipient; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Notifier\Exception\InvalidArgumentException; use Symfony\Component\Notifier\Recipient\Recipient; /** * @author Jan Schädlich <jan.schaedlich@sensiolabs.de> */ class RecipientTest extends TestCase { public function testCannotBeConstructedWithoutEmailAndWithoutPhone() { $this->expectException(InvalidArgumentException::class); new Recipient('', ''); } #[DataProvider('provideValidEmailAndPhone')] public function testCanBeConstructed(string $email, string $phone) { $recipient = new Recipient($email, $phone); $this->assertSame($email, $recipient->getEmail()); $this->assertSame($phone, $recipient->getPhone()); } public static function provideValidEmailAndPhone() { yield ['test@test.de', '+0815']; yield ['test@test.de', '']; yield ['', '+0815']; } public function testEmailAndPhoneAreNotImmutable() { $recipient = new Recipient('test@test.de', '+0815'); $this->assertSame('test@test.de', $recipient->getEmail()); $this->assertSame('+0815', $recipient->getPhone()); $recipient->email('test@test.com'); $recipient->phone('+49815'); $this->assertSame('test@test.com', $recipient->getEmail()); $this->assertSame('+49815', $recipient->getPhone()); } }