radarrplexorganizrnginxsonarrdashboardserverhomepagesabnzbdheimdallembycouchpotatonzbgetbookmarkapplication-dashboardmuximuxlandingpagestartpagelandinghtpc
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.9 KiB
61 lines
1.9 KiB
<?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\Mime\Tests;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use Symfony\Component\Mime\Address;
|
|
use Symfony\Component\Mime\NamedAddress;
|
|
|
|
class AddressTest extends TestCase
|
|
{
|
|
public function testConstructor()
|
|
{
|
|
$a = new Address('fabien@symfonï.com');
|
|
$this->assertEquals('fabien@symfonï.com', $a->getAddress());
|
|
$this->assertEquals('fabien@xn--symfon-nwa.com', $a->toString());
|
|
$this->assertEquals('fabien@xn--symfon-nwa.com', $a->getEncodedAddress());
|
|
}
|
|
|
|
public function testConstructorWithInvalidAddress()
|
|
{
|
|
$this->expectException(\InvalidArgumentException::class);
|
|
new Address('fab pot@symfony.com');
|
|
}
|
|
|
|
public function testCreate()
|
|
{
|
|
$this->assertSame($a = new Address('fabien@symfony.com'), Address::create($a));
|
|
$this->assertSame($b = new NamedAddress('helene@symfony.com', 'Helene'), Address::create($b));
|
|
$this->assertEquals($a, Address::create('fabien@symfony.com'));
|
|
}
|
|
|
|
public function testCreateWrongArg()
|
|
{
|
|
$this->expectException(\InvalidArgumentException::class);
|
|
Address::create(new \stdClass());
|
|
}
|
|
|
|
public function testCreateArray()
|
|
{
|
|
$fabien = new Address('fabien@symfony.com');
|
|
$helene = new NamedAddress('helene@symfony.com', 'Helene');
|
|
$this->assertSame([$fabien, $helene], Address::createArray([$fabien, $helene]));
|
|
|
|
$this->assertEquals([$fabien], Address::createArray(['fabien@symfony.com']));
|
|
}
|
|
|
|
public function testCreateArrayWrongArg()
|
|
{
|
|
$this->expectException(\InvalidArgumentException::class);
|
|
Address::createArray([new \stdClass()]);
|
|
}
|
|
}
|
|
|