12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- /*
- * This file is part of the Sonata Project package.
- *
- * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Sonata\AdminBundle\Tests\Form\DataTransformer;
- use Sonata\AdminBundle\Form\DataTransformer\ModelsToArrayTransformer;
- class ModelsToArrayTransformerTest extends \PHPUnit_Framework_TestCase
- {
- private $modelManager;
- protected function setUp()
- {
- $this->modelManager = $this->prophesize('Sonata\AdminBundle\Model\ModelManagerInterface')->reveal();
- }
- public function testConstructor()
- {
- $transformer = new ModelsToArrayTransformer(
- $this->modelManager,
- 'Sonata\AdminBundle\Tests\Fixtures\Entity\Foo'
- );
- $this->assertInstanceOf('Sonata\AdminBundle\Form\DataTransformer\ModelsToArrayTransformer', $transformer);
- }
- /**
- * @group legacy
- */
- public function testLegacyConstructor()
- {
- $choiceListClass = interface_exists('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')
- ? 'Sonata\AdminBundle\Form\ChoiceList\ModelChoiceLoader'
- : 'Sonata\AdminBundle\Form\ChoiceList\ModelChoiceList'
- ;
- $choiceList = $this->prophesize($choiceListClass)->reveal();
- $transformer = new ModelsToArrayTransformer(
- $choiceList,
- $this->modelManager,
- 'Sonata\AdminBundle\Tests\Fixtures\Entity\Foo'
- );
- $this->assertInstanceOf('Sonata\AdminBundle\Form\DataTransformer\ModelsToArrayTransformer', $transformer);
- }
- }
|