Initial Drupal 11 with DDEV setup
This commit is contained in:
		
							
								
								
									
										64
									
								
								vendor/symfony/mime/Test/Constraint/EmailAddressContains.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								vendor/symfony/mime/Test/Constraint/EmailAddressContains.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,64 @@
 | 
			
		||||
<?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\Test\Constraint;
 | 
			
		||||
 | 
			
		||||
use PHPUnit\Framework\Constraint\Constraint;
 | 
			
		||||
use Symfony\Component\Mime\Header\MailboxHeader;
 | 
			
		||||
use Symfony\Component\Mime\Header\MailboxListHeader;
 | 
			
		||||
use Symfony\Component\Mime\RawMessage;
 | 
			
		||||
 | 
			
		||||
final class EmailAddressContains extends Constraint
 | 
			
		||||
{
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        private string $headerName,
 | 
			
		||||
        private string $expectedValue,
 | 
			
		||||
    ) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function toString(): string
 | 
			
		||||
    {
 | 
			
		||||
        return \sprintf('contains address "%s" with value "%s"', $this->headerName, $this->expectedValue);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param RawMessage $message
 | 
			
		||||
     */
 | 
			
		||||
    protected function matches($message): bool
 | 
			
		||||
    {
 | 
			
		||||
        if (RawMessage::class === $message::class) {
 | 
			
		||||
            throw new \LogicException('Unable to test a message address on a RawMessage instance.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $header = $message->getHeaders()->get($this->headerName);
 | 
			
		||||
        if ($header instanceof MailboxHeader) {
 | 
			
		||||
            return $this->expectedValue === $header->getAddress()->getAddress();
 | 
			
		||||
        } elseif ($header instanceof MailboxListHeader) {
 | 
			
		||||
            foreach ($header->getAddresses() as $address) {
 | 
			
		||||
                if ($this->expectedValue === $address->getAddress()) {
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new \LogicException('Unable to test a message address on a non-address header.');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param RawMessage $message
 | 
			
		||||
     */
 | 
			
		||||
    protected function failureDescription($message): string
 | 
			
		||||
    {
 | 
			
		||||
        return \sprintf('the Email %s (value is %s)', $this->toString(), $message->getHeaders()->get($this->headerName)->getBodyAsString());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										49
									
								
								vendor/symfony/mime/Test/Constraint/EmailAttachmentCount.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								vendor/symfony/mime/Test/Constraint/EmailAttachmentCount.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,49 @@
 | 
			
		||||
<?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\Test\Constraint;
 | 
			
		||||
 | 
			
		||||
use PHPUnit\Framework\Constraint\Constraint;
 | 
			
		||||
use Symfony\Component\Mime\Message;
 | 
			
		||||
use Symfony\Component\Mime\RawMessage;
 | 
			
		||||
 | 
			
		||||
final class EmailAttachmentCount extends Constraint
 | 
			
		||||
{
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        private int $expectedValue,
 | 
			
		||||
    ) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function toString(): string
 | 
			
		||||
    {
 | 
			
		||||
        return \sprintf('has sent "%d" attachment(s)', $this->expectedValue);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param RawMessage $message
 | 
			
		||||
     */
 | 
			
		||||
    protected function matches($message): bool
 | 
			
		||||
    {
 | 
			
		||||
        if (RawMessage::class === $message::class || Message::class === $message::class) {
 | 
			
		||||
            throw new \LogicException('Unable to test a message attachment on a RawMessage or Message instance.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->expectedValue === \count($message->getAttachments());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param RawMessage $message
 | 
			
		||||
     */
 | 
			
		||||
    protected function failureDescription($message): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'the Email '.$this->toString();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										48
									
								
								vendor/symfony/mime/Test/Constraint/EmailHasHeader.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								vendor/symfony/mime/Test/Constraint/EmailHasHeader.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,48 @@
 | 
			
		||||
<?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\Test\Constraint;
 | 
			
		||||
 | 
			
		||||
use PHPUnit\Framework\Constraint\Constraint;
 | 
			
		||||
use Symfony\Component\Mime\RawMessage;
 | 
			
		||||
 | 
			
		||||
final class EmailHasHeader extends Constraint
 | 
			
		||||
{
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        private string $headerName,
 | 
			
		||||
    ) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function toString(): string
 | 
			
		||||
    {
 | 
			
		||||
        return \sprintf('has header "%s"', $this->headerName);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param RawMessage $message
 | 
			
		||||
     */
 | 
			
		||||
    protected function matches($message): bool
 | 
			
		||||
    {
 | 
			
		||||
        if (RawMessage::class === $message::class) {
 | 
			
		||||
            throw new \LogicException('Unable to test a message header on a RawMessage instance.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $message->getHeaders()->has($this->headerName);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param RawMessage $message
 | 
			
		||||
     */
 | 
			
		||||
    protected function failureDescription($message): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'the Email '.$this->toString();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										59
									
								
								vendor/symfony/mime/Test/Constraint/EmailHeaderSame.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								vendor/symfony/mime/Test/Constraint/EmailHeaderSame.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,59 @@
 | 
			
		||||
<?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\Test\Constraint;
 | 
			
		||||
 | 
			
		||||
use PHPUnit\Framework\Constraint\Constraint;
 | 
			
		||||
use Symfony\Component\Mime\Header\UnstructuredHeader;
 | 
			
		||||
use Symfony\Component\Mime\RawMessage;
 | 
			
		||||
 | 
			
		||||
final class EmailHeaderSame extends Constraint
 | 
			
		||||
{
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        private string $headerName,
 | 
			
		||||
        private string $expectedValue,
 | 
			
		||||
    ) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function toString(): string
 | 
			
		||||
    {
 | 
			
		||||
        return \sprintf('has header "%s" with value "%s"', $this->headerName, $this->expectedValue);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param RawMessage $message
 | 
			
		||||
     */
 | 
			
		||||
    protected function matches($message): bool
 | 
			
		||||
    {
 | 
			
		||||
        if (RawMessage::class === $message::class) {
 | 
			
		||||
            throw new \LogicException('Unable to test a message header on a RawMessage instance.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->expectedValue === $this->getHeaderValue($message);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param RawMessage $message
 | 
			
		||||
     */
 | 
			
		||||
    protected function failureDescription($message): string
 | 
			
		||||
    {
 | 
			
		||||
        return \sprintf('the Email %s (value is %s)', $this->toString(), $this->getHeaderValue($message) ?? 'null');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function getHeaderValue($message): ?string
 | 
			
		||||
    {
 | 
			
		||||
        if (null === $header = $message->getHeaders()->get($this->headerName)) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $header instanceof UnstructuredHeader ? $header->getValue() : $header->getBodyAsString();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										49
									
								
								vendor/symfony/mime/Test/Constraint/EmailHtmlBodyContains.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								vendor/symfony/mime/Test/Constraint/EmailHtmlBodyContains.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,49 @@
 | 
			
		||||
<?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\Test\Constraint;
 | 
			
		||||
 | 
			
		||||
use PHPUnit\Framework\Constraint\Constraint;
 | 
			
		||||
use Symfony\Component\Mime\Message;
 | 
			
		||||
use Symfony\Component\Mime\RawMessage;
 | 
			
		||||
 | 
			
		||||
final class EmailHtmlBodyContains extends Constraint
 | 
			
		||||
{
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        private string $expectedText,
 | 
			
		||||
    ) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function toString(): string
 | 
			
		||||
    {
 | 
			
		||||
        return \sprintf('contains "%s"', $this->expectedText);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param RawMessage $message
 | 
			
		||||
     */
 | 
			
		||||
    protected function matches($message): bool
 | 
			
		||||
    {
 | 
			
		||||
        if (RawMessage::class === $message::class || Message::class === $message::class) {
 | 
			
		||||
            throw new \LogicException('Unable to test a message HTML body on a RawMessage or Message instance.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return str_contains($message->getHtmlBody(), $this->expectedText);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param RawMessage $message
 | 
			
		||||
     */
 | 
			
		||||
    protected function failureDescription($message): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'the Email HTML body '.$this->toString();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										47
									
								
								vendor/symfony/mime/Test/Constraint/EmailSubjectContains.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								vendor/symfony/mime/Test/Constraint/EmailSubjectContains.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,47 @@
 | 
			
		||||
<?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\Test\Constraint;
 | 
			
		||||
 | 
			
		||||
use PHPUnit\Framework\Constraint\Constraint;
 | 
			
		||||
use Symfony\Component\Mime\Email;
 | 
			
		||||
 | 
			
		||||
final class EmailSubjectContains extends Constraint
 | 
			
		||||
{
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        private readonly string $expectedSubjectValue,
 | 
			
		||||
    ) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function toString(): string
 | 
			
		||||
    {
 | 
			
		||||
        return \sprintf('contains subject with value "%s"', $this->expectedSubjectValue);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function matches($other): bool
 | 
			
		||||
    {
 | 
			
		||||
        if (!$other instanceof Email) {
 | 
			
		||||
            throw new \LogicException('Can only test a message subject on an Email instance.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return str_contains((string) $other->getSubject(), $this->expectedSubjectValue);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function failureDescription($other): string
 | 
			
		||||
    {
 | 
			
		||||
        $message = 'The email subject '.$this->toString();
 | 
			
		||||
        if ($other instanceof Email) {
 | 
			
		||||
            $message .= \sprintf('. The subject was: "%s"', $other->getSubject() ?? '<empty>');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $message;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										49
									
								
								vendor/symfony/mime/Test/Constraint/EmailTextBodyContains.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								vendor/symfony/mime/Test/Constraint/EmailTextBodyContains.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,49 @@
 | 
			
		||||
<?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\Test\Constraint;
 | 
			
		||||
 | 
			
		||||
use PHPUnit\Framework\Constraint\Constraint;
 | 
			
		||||
use Symfony\Component\Mime\Message;
 | 
			
		||||
use Symfony\Component\Mime\RawMessage;
 | 
			
		||||
 | 
			
		||||
final class EmailTextBodyContains extends Constraint
 | 
			
		||||
{
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        private string $expectedText,
 | 
			
		||||
    ) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function toString(): string
 | 
			
		||||
    {
 | 
			
		||||
        return \sprintf('contains "%s"', $this->expectedText);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param RawMessage $message
 | 
			
		||||
     */
 | 
			
		||||
    protected function matches($message): bool
 | 
			
		||||
    {
 | 
			
		||||
        if (RawMessage::class === $message::class || Message::class === $message::class) {
 | 
			
		||||
            throw new \LogicException('Unable to test a message text body on a RawMessage or Message instance.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return str_contains($message->getTextBody(), $this->expectedText);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param RawMessage $message
 | 
			
		||||
     */
 | 
			
		||||
    protected function failureDescription($message): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'the Email text body '.$this->toString();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user