[PropertyInfo] Test behavior when an extractor return null.

This commit is contained in:
Kévin Dunglas 2015-10-02 12:16:37 +02:00
parent 2ff0f97c60
commit 73ee226a1f
2 changed files with 70 additions and 1 deletions

View File

@ -0,0 +1,68 @@
<?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\Fixtures;
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\PropertyInfo\Type;
/**
* Not able to guess anything.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class NullExtractor implements PropertyListExtractorInterface, PropertyDescriptionExtractorInterface, PropertyTypeExtractorInterface, PropertyAccessExtractorInterface
{
/**
* {@inheritdoc}
*/
public function getShortDescription($class, $property, array $context = array())
{
}
/**
* {@inheritdoc}
*/
public function getLongDescription($class, $property, array $context = array())
{
}
/**
* {@inheritdoc}
*/
public function getTypes($class, $property, array $context = array())
{
}
/**
* {@inheritdoc}
*/
public function isReadable($class, $property, array $context = array())
{
}
/**
* {@inheritdoc}
*/
public function isWritable($class, $property, array $context = array())
{
}
/**
* {@inheritdoc}
*/
public function getProperties($class, array $context = array())
{
}
}

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\PropertyInfo\PropertyInfo\Tests;
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\DummyExtractor;
use Symfony\Component\PropertyInfo\Tests\Fixtures\NullExtractor;
use Symfony\Component\PropertyInfo\Type;
/**
@ -27,7 +28,7 @@ class PropertyInfoExtractorTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
$extractors = array(new DummyExtractor());
$extractors = array(new NullExtractor(), new DummyExtractor());
$this->propertyInfo = new PropertyInfoExtractor($extractors, $extractors, $extractors, $extractors);
}