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 declare(strict_types=1); namespace Doctrine\DBAL\Tests\Types; use DateTime; use D..

Decoded Output download

<?php

declare(strict_types=1);

namespace Doctrine\DBAL\Tests\Types;

use DateTime;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\TimeType;

class TimeTest extends BaseDateTypeTestCase
{
    protected function setUp(): void
    {
        $this->type = new TimeType();

        parent::setUp();

        $this->platform->method('getTimeFormatString')
            ->willReturn('H:i:s');
    }

    public function testTimeConvertsToPHPValue(): void
    {
        self::assertInstanceOf(DateTime::class, $this->type->convertToPHPValue('5:30:55', $this->platform));
    }

    public function testDateFieldResetInPHPValue(): void
    {
        $time = $this->type->convertToPHPValue('01:23:34', $this->platform);

        self::assertEquals('01:23:34', $time->format('H:i:s'));
        self::assertEquals('1970-01-01', $time->format('Y-m-d'));
    }

    public function testInvalidTimeFormatConversion(): void
    {
        $this->expectException(ConversionException::class);
        $this->type->convertToPHPValue('abcdefg', $this->platform);
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace Doctrine\DBAL\Tests\Types;

use DateTime;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\TimeType;

class TimeTest extends BaseDateTypeTestCase
{
    protected function setUp(): void
    {
        $this->type = new TimeType();

        parent::setUp();

        $this->platform->method('getTimeFormatString')
            ->willReturn('H:i:s');
    }

    public function testTimeConvertsToPHPValue(): void
    {
        self::assertInstanceOf(DateTime::class, $this->type->convertToPHPValue('5:30:55', $this->platform));
    }

    public function testDateFieldResetInPHPValue(): void
    {
        $time = $this->type->convertToPHPValue('01:23:34', $this->platform);

        self::assertEquals('01:23:34', $time->format('H:i:s'));
        self::assertEquals('1970-01-01', $time->format('Y-m-d'));
    }

    public function testInvalidTimeFormatConversion(): void
    {
        $this->expectException(ConversionException::class);
        $this->type->convertToPHPValue('abcdefg', $this->platform);
    }
}

Function Calls

None

Variables

None

Stats

MD5 5f484b89f49e0f8200167d3463970914
Eval Count 0
Decode Time 93 ms