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 Section. */ namespace SendGrid\Tests\Unit; use PHPUnit\Fra..

Decoded Output download

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

namespace SendGrid\Tests\Unit;

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

/**
 * This class tests Section.
 *
 * @package SendGrid\Tests
 */
class SectionTest extends TestCase
{
    public function testConstructor()
    {
        $section = new Section('key', 'value');

        $this->assertInstanceOf(Section::class, $section);
        $this->assertSame('key', $section->getKey());
        $this->assertSame('value', $section->getValue());
    }

    public function testSetKey()
    {
        $section = new Section();
        $section->setKey('key');

        $this->assertSame('key', $section->getKey());
    }

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

        $section = new Section();
        $section->setKey(true);
    }

    public function testSetValue()
    {
        $section = new Section();
        $section->setValue('value');

        $this->assertSame('value', $section->getValue());
    }

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

        $section = new Section();
        $section->setValue(true);
    }
}
 ?>

Did this file decode correctly?

Original Code

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

namespace SendGrid\Tests\Unit;

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

/**
 * This class tests Section.
 *
 * @package SendGrid\Tests
 */
class SectionTest extends TestCase
{
    public function testConstructor()
    {
        $section = new Section('key', 'value');

        $this->assertInstanceOf(Section::class, $section);
        $this->assertSame('key', $section->getKey());
        $this->assertSame('value', $section->getValue());
    }

    public function testSetKey()
    {
        $section = new Section();
        $section->setKey('key');

        $this->assertSame('key', $section->getKey());
    }

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

        $section = new Section();
        $section->setKey(true);
    }

    public function testSetValue()
    {
        $section = new Section();
        $section->setValue('value');

        $this->assertSame('value', $section->getValue());
    }

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

        $section = new Section();
        $section->setValue(true);
    }
}

Function Calls

None

Variables

None

Stats

MD5 399568d7d5fa70adcf9ceabec4c4414c
Eval Count 0
Decode Time 88 ms