Classes List

Symfony\Component\PropertyInfo\Tests\AbstractPropertyInfoExtractorTest

 1 
 2 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
 10 
 11 
 12 
 13 
 14 
 15 
 16 
 17 
 18 
 19 
 20 
 21 
 22 
 23 
 24 
 25 
 26 
 27 
 28 
 29 
 30 
 31 
 32 
 33 
 34 
 35 
 36 
 37 
 38 
 39 
 40 
 41 
 42 
 43 
 44 
 45 
 46 
 47 
 48 
 49 
 50 
 51 
 52 
 53 
 54 
 55 
 56 
 57 
 58 
 59 
 60 
 61 
 62 
 63 
 64 
 65 
 66 
 67 
 68 
 69 
 70 
 71 
 72 
 73 
 74 
<?php

/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * 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\PropertyInfoExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\NullExtractor;
use Symfony\Component\PropertyInfo\Type;

/** * @author Kévin Dunglas <dunglas@gmail.com> */
class AbstractPropertyInfoExtractorTest extends TestCase
{
    /** * @var PropertyInfoExtractor */
    protected $propertyInfo;

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

    public function testInstanceOf()
    {
        $this->assertInstanceOf('Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface'$this->propertyInfo);
        $this->assertInstanceOf('Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface'$this->propertyInfo);
        $this->assertInstanceOf('Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface'$this->propertyInfo);
        $this->assertInstanceOf('Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface'$this->propertyInfo);
    }

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

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

    public function testGetTypes()
    {
        $this->assertEquals(array(new Type(Type::BUILTIN_TYPE_INT)), $this->propertyInfo->getTypes('Foo''bar'array()));
    }

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

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

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