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 is part of the Symfony package. * * (c) Fabien Potencier <fabien@..
Decoded Output download
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Extension\Core\DataTransformer\UuidToStringTransformer;
use Symfony\Component\Uid\Uuid;
use Symfony\Component\Uid\UuidV1;
class UuidToStringTransformerTest extends TestCase
{
public function testTransform()
{
$transformer = new UuidToStringTransformer();
$this->assertEquals('123e4567-e89b-12d3-a456-426655440000', $transformer->transform(new UuidV1('123e4567-e89b-12d3-a456-426655440000')));
}
public function testTransformEmpty()
{
$transformer = new UuidToStringTransformer();
$this->assertNull($transformer->transform(null));
}
public function testTransformExpectsUuid()
{
$transformer = new UuidToStringTransformer();
$this->expectException(TransformationFailedException::class);
$transformer->transform('1234');
}
public function testReverseTransform()
{
$transformer = new UuidToStringTransformer();
$this->assertEquals(new UuidV1('123e4567-e89b-12d3-a456-426655440000'), $transformer->reverseTransform('123e4567-e89b-12d3-a456-426655440000'));
}
public function testReverseTransformEmpty()
{
$reverseTransformer = new UuidToStringTransformer();
$this->assertNull($reverseTransformer->reverseTransform(''));
}
public function testReverseTransformExpectsString()
{
$reverseTransformer = new UuidToStringTransformer();
$this->expectException(TransformationFailedException::class);
$reverseTransformer->reverseTransform(Uuid::fromString('123e4567-e89b-12d3-a456-426655440000')->toBase32());
}
public function testReverseTransformExpectsValidUuidString()
{
$reverseTransformer = new UuidToStringTransformer();
$this->expectException(TransformationFailedException::class);
$reverseTransformer->reverseTransform('1234');
}
}
?>
Did this file decode correctly?
Original Code
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Extension\Core\DataTransformer\UuidToStringTransformer;
use Symfony\Component\Uid\Uuid;
use Symfony\Component\Uid\UuidV1;
class UuidToStringTransformerTest extends TestCase
{
public function testTransform()
{
$transformer = new UuidToStringTransformer();
$this->assertEquals('123e4567-e89b-12d3-a456-426655440000', $transformer->transform(new UuidV1('123e4567-e89b-12d3-a456-426655440000')));
}
public function testTransformEmpty()
{
$transformer = new UuidToStringTransformer();
$this->assertNull($transformer->transform(null));
}
public function testTransformExpectsUuid()
{
$transformer = new UuidToStringTransformer();
$this->expectException(TransformationFailedException::class);
$transformer->transform('1234');
}
public function testReverseTransform()
{
$transformer = new UuidToStringTransformer();
$this->assertEquals(new UuidV1('123e4567-e89b-12d3-a456-426655440000'), $transformer->reverseTransform('123e4567-e89b-12d3-a456-426655440000'));
}
public function testReverseTransformEmpty()
{
$reverseTransformer = new UuidToStringTransformer();
$this->assertNull($reverseTransformer->reverseTransform(''));
}
public function testReverseTransformExpectsString()
{
$reverseTransformer = new UuidToStringTransformer();
$this->expectException(TransformationFailedException::class);
$reverseTransformer->reverseTransform(Uuid::fromString('123e4567-e89b-12d3-a456-426655440000')->toBase32());
}
public function testReverseTransformExpectsValidUuidString()
{
$reverseTransformer = new UuidToStringTransformer();
$this->expectException(TransformationFailedException::class);
$reverseTransformer->reverseTransform('1234');
}
}
Function Calls
None |
Stats
MD5 | b65e2249747ceb56ee32cc899db83185 |
Eval Count | 0 |
Decode Time | 103 ms |