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\PropertyInfo\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\NullExtractor;
use Symfony\Component\PropertyInfo\Type as LegacyType;
use Symfony\Component\TypeInfo\Type;

/**
 * @author Kvin Dunglas <[email protected]>
 */
class AbstractPropertyInfoExtractorTest extends TestCase
{
    protected PropertyInfoExtractorInterface $propertyInfo;

    protected function setUp(): void
    {
        $extractors = [new NullExtractor(), new DummyExtractor()];
        $this->propertyInfo = new PropertyInfoExtractor($extractors, $extractors, $extractors, $extractors, $extractors);
    }

    public function testInstanceOf()
    {
        $this->assertInstanceOf(PropertyInfoExtractorInterface::class, $this->propertyInfo);
        $this->assertInstanceOf(PropertyTypeExtractorInterface::class, $this->propertyInfo);
        $this->assertInstanceOf(PropertyDescriptionExtractorInterface::class, $this->propertyInfo);
        $this->assertInstanceOf(PropertyAccessExtractorInterface::class, $this->propertyInfo);
        $this->assertInstanceOf(PropertyInitializableExtractorInterface::class, $this->propertyInfo);
    }

    public function testGetShortDescription()
    {
        $this->assertSame('short', $this->propertyInfo->getShortDescription('Foo', 'bar', []));
    }

    public function testGetLongDescription()
    {
        $this->assertSame('long', $this->propertyInfo->getLongDescription('Foo', 'bar', []));
    }

    public function testGetType()
    {
        $this->assertEquals(Type::int(), $this->propertyInfo->getType('Foo', 'bar', []));
    }

    /**
     * @group legacy
     */
    public function testGetTypes()
    {
        $this->assertEquals([new LegacyType(LegacyType::BUILTIN_TYPE_INT)], $this->propertyInfo->getTypes('Foo', 'bar', []));
    }

    public function testIsReadable()
    {
        $this->assertTrue($this->propertyInfo->isReadable('Foo', 'bar', []));
    }

    public function testIsWritable()
    {
        $this->assertTrue($this->propertyInfo->isWritable('Foo', 'bar', []));
    }

    public function testGetProperties()
    {
        $this->assertEquals(['a', 'b'], $this->propertyInfo->getProperties('Foo'));
    }

    public function testIsInitializable()
    {
        $this->assertTrue($this->propertyInfo->isInitializable('Foo', 'bar', []));
    }
}
 ?>

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\PropertyInfo\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\NullExtractor;
use Symfony\Component\PropertyInfo\Type as LegacyType;
use Symfony\Component\TypeInfo\Type;

/**
 * @author Kvin Dunglas <[email protected]>
 */
class AbstractPropertyInfoExtractorTest extends TestCase
{
    protected PropertyInfoExtractorInterface $propertyInfo;

    protected function setUp(): void
    {
        $extractors = [new NullExtractor(), new DummyExtractor()];
        $this->propertyInfo = new PropertyInfoExtractor($extractors, $extractors, $extractors, $extractors, $extractors);
    }

    public function testInstanceOf()
    {
        $this->assertInstanceOf(PropertyInfoExtractorInterface::class, $this->propertyInfo);
        $this->assertInstanceOf(PropertyTypeExtractorInterface::class, $this->propertyInfo);
        $this->assertInstanceOf(PropertyDescriptionExtractorInterface::class, $this->propertyInfo);
        $this->assertInstanceOf(PropertyAccessExtractorInterface::class, $this->propertyInfo);
        $this->assertInstanceOf(PropertyInitializableExtractorInterface::class, $this->propertyInfo);
    }

    public function testGetShortDescription()
    {
        $this->assertSame('short', $this->propertyInfo->getShortDescription('Foo', 'bar', []));
    }

    public function testGetLongDescription()
    {
        $this->assertSame('long', $this->propertyInfo->getLongDescription('Foo', 'bar', []));
    }

    public function testGetType()
    {
        $this->assertEquals(Type::int(), $this->propertyInfo->getType('Foo', 'bar', []));
    }

    /**
     * @group legacy
     */
    public function testGetTypes()
    {
        $this->assertEquals([new LegacyType(LegacyType::BUILTIN_TYPE_INT)], $this->propertyInfo->getTypes('Foo', 'bar', []));
    }

    public function testIsReadable()
    {
        $this->assertTrue($this->propertyInfo->isReadable('Foo', 'bar', []));
    }

    public function testIsWritable()
    {
        $this->assertTrue($this->propertyInfo->isWritable('Foo', 'bar', []));
    }

    public function testGetProperties()
    {
        $this->assertEquals(['a', 'b'], $this->propertyInfo->getProperties('Foo'));
    }

    public function testIsInitializable()
    {
        $this->assertTrue($this->propertyInfo->isInitializable('Foo', 'bar', []));
    }
}

Function Calls

None

Variables

None

Stats

MD5 ff4f04336d452297bf3abc42dcc3c031
Eval Count 0
Decode Time 102 ms