Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /** * This file tests Header. */ namespace SendGrid\Tests\Unit; use PHPUnit\Fram..

Decoded Output download

<?php
/**
 * This file tests Header.
 */

namespace SendGrid\Tests\Unit;

use PHPUnit\Framework\TestCase;
use SendGrid\Mail\Header;
use SendGrid\Mail\TypeException;

/**
 * This file tests Header.
 *
 * @package SendGrid\Tests
 */
class HeaderTest extends TestCase
{
    public function testConstructor()
    {
        $header = new Header('Content-Type', 'text/plain');

        $this->assertSame('Content-Type', $header->getKey());
        $this->assertSame('text/plain', $header->getValue());
    }

    public function testSetKey()
    {
        $header = new Header();
        $header->setKey('Content-Type');

        $this->assertSame('Content-Type', $header->getKey());
    }

    public function testSetKeyOnInvalidType()
    {
        $this->expectException(TypeException::class);
        $this->expectExceptionMessageMatches('/"\$key" must be a string/');

        $header = new Header();
        $header->setKey(123);
    }

    public function testSetValue()
    {
        $header = new Header();
        $header->setValue('text/plain');

        $this->assertSame('text/plain', $header->getValue());
    }

    public function testSetValueOnInvalidType()
    {
        $this->expectException(TypeException::class);
        $this->expectExceptionMessageMatches('/"\$value" must be a string/');

        $header = new Header();
        $header->setValue(123);
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php
/**
 * This file tests Header.
 */

namespace SendGrid\Tests\Unit;

use PHPUnit\Framework\TestCase;
use SendGrid\Mail\Header;
use SendGrid\Mail\TypeException;

/**
 * This file tests Header.
 *
 * @package SendGrid\Tests
 */
class HeaderTest extends TestCase
{
    public function testConstructor()
    {
        $header = new Header('Content-Type', 'text/plain');

        $this->assertSame('Content-Type', $header->getKey());
        $this->assertSame('text/plain', $header->getValue());
    }

    public function testSetKey()
    {
        $header = new Header();
        $header->setKey('Content-Type');

        $this->assertSame('Content-Type', $header->getKey());
    }

    public function testSetKeyOnInvalidType()
    {
        $this->expectException(TypeException::class);
        $this->expectExceptionMessageMatches('/"\$key" must be a string/');

        $header = new Header();
        $header->setKey(123);
    }

    public function testSetValue()
    {
        $header = new Header();
        $header->setValue('text/plain');

        $this->assertSame('text/plain', $header->getValue());
    }

    public function testSetValueOnInvalidType()
    {
        $this->expectException(TypeException::class);
        $this->expectExceptionMessageMatches('/"\$value" must be a string/');

        $header = new Header();
        $header->setValue(123);
    }
}

Function Calls

None

Variables

None

Stats

MD5 e22b4ccb73aeb2f68a6796f45f009263
Eval Count 0
Decode Time 96 ms