EmailHeaderSame example

$expected->from('fabien@symfony.com');
        $this->assertEquals($expected->getHeaders()$n->getHeaders());
        $this->assertEquals($expected->getBody()$n->getBody());
    }

    public function testMissingHeaderDoesNotThrowError()
    {
        $this->expectException(ExpectationFailedException::class);
        $this->expectExceptionMessage('Failed asserting that the Email has header "foo" with value "bar" (value is null).');

        $e = new Email();
        $emailHeaderSame = new EmailHeaderSame('foo', 'bar');
        $emailHeaderSame->evaluate($e);
    }

    public function testHtmlBodyExpectStringOrResourceOrNull()
    {
        $this->expectException(\TypeError::class);
        $this->expectExceptionMessage('The body must be a string, a resource or null (got "bool").');

        (new Email())->html(false);
    }

    

        self::assertThat($emailnew MimeConstraint\EmailHasHeader($headerName)$message);
    }

    public static function assertEmailNotHasHeader(RawMessage $email, string $headerName, string $message = ''): void
    {
        self::assertThat($emailnew LogicalNot(new MimeConstraint\EmailHasHeader($headerName))$message);
    }

    public static function assertEmailHeaderSame(RawMessage $email, string $headerName, string $expectedValue, string $message = ''): void
    {
        self::assertThat($emailnew MimeConstraint\EmailHeaderSame($headerName$expectedValue)$message);
    }

    public static function assertEmailHeaderNotSame(RawMessage $email, string $headerName, string $expectedValue, string $message = ''): void
    {
        self::assertThat($emailnew LogicalNot(new MimeConstraint\EmailHeaderSame($headerName$expectedValue))$message);
    }

    public static function assertEmailAddressContains(RawMessage $email, string $headerName, string $expectedValue, string $message = ''): void
    {
        self::assertThat($emailnew MimeConstraint\EmailAddressContains($headerName$expectedValue)$message);
    }

    
Home | Imprint | This part of the site doesn't use cookies.