minor #16721 [DoctrineBridge] remove unused abstract test classes (xabbuh)
This PR was merged into the 3.0-dev branch.
Discussion
----------
[DoctrineBridge] remove unused abstract test classes
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #15696
| License | MIT
| Doc PR |
Tests depending on these classes have already been removed in #15696.
Commits
-------
0108cd4
remove unused abstract test classes
This commit is contained in:
commit
2a22d8696b
@ -1,58 +0,0 @@
|
|||||||
<?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\Bridge\Doctrine\Tests\Form\ChoiceList;
|
|
||||||
|
|
||||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
|
||||||
*/
|
|
||||||
abstract class AbstractEntityChoiceListCompositeIdTest extends AbstractEntityChoiceListTest
|
|
||||||
{
|
|
||||||
protected function getEntityClass()
|
|
||||||
{
|
|
||||||
return 'Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface
|
|
||||||
*/
|
|
||||||
protected function createObjects()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
new CompositeIntIdEntity(10, 11, 'A'),
|
|
||||||
new CompositeIntIdEntity(20, 21, 'B'),
|
|
||||||
new CompositeIntIdEntity(30, 31, 'C'),
|
|
||||||
new CompositeIntIdEntity(40, 41, 'D'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getChoices()
|
|
||||||
{
|
|
||||||
return array(0 => $this->obj1, 1 => $this->obj2, 2 => $this->obj3, 3 => $this->obj4);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getLabels()
|
|
||||||
{
|
|
||||||
return array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getValues()
|
|
||||||
{
|
|
||||||
return array(0 => '0', 1 => '1', 2 => '2', 3 => '3');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getIndices()
|
|
||||||
{
|
|
||||||
return array(0, 1, 2, 3);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
<?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\Bridge\Doctrine\Tests\Form\ChoiceList;
|
|
||||||
|
|
||||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
|
||||||
*/
|
|
||||||
abstract class AbstractEntityChoiceListSingleIntIdTest extends AbstractEntityChoiceListTest
|
|
||||||
{
|
|
||||||
protected function getEntityClass()
|
|
||||||
{
|
|
||||||
return 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface
|
|
||||||
*/
|
|
||||||
protected function createObjects()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
new SingleIntIdEntity(-10, 'A'),
|
|
||||||
new SingleIntIdEntity(10, 'B'),
|
|
||||||
new SingleIntIdEntity(20, 'C'),
|
|
||||||
new SingleIntIdEntity(30, 'D'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getChoices()
|
|
||||||
{
|
|
||||||
return array('_10' => $this->obj1, 10 => $this->obj2, 20 => $this->obj3, 30 => $this->obj4);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getLabels()
|
|
||||||
{
|
|
||||||
return array('_10' => 'A', 10 => 'B', 20 => 'C', 30 => 'D');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getValues()
|
|
||||||
{
|
|
||||||
return array('_10' => '-10', 10 => '10', 20 => '20', 30 => '30');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getIndices()
|
|
||||||
{
|
|
||||||
return array('_10', 10, 20, 30);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
<?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\Bridge\Doctrine\Tests\Form\ChoiceList;
|
|
||||||
|
|
||||||
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
|
||||||
*/
|
|
||||||
abstract class AbstractEntityChoiceListSingleStringIdTest extends AbstractEntityChoiceListTest
|
|
||||||
{
|
|
||||||
protected function getEntityClass()
|
|
||||||
{
|
|
||||||
return 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface
|
|
||||||
*/
|
|
||||||
protected function createObjects()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
new SingleStringIdEntity('a', 'A'),
|
|
||||||
new SingleStringIdEntity('b', 'B'),
|
|
||||||
new SingleStringIdEntity('c', 'C'),
|
|
||||||
new SingleStringIdEntity('d', 'D'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getChoices()
|
|
||||||
{
|
|
||||||
return array(0 => $this->obj1, 1 => $this->obj2, 2 => $this->obj3, 3 => $this->obj4);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getLabels()
|
|
||||||
{
|
|
||||||
return array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getValues()
|
|
||||||
{
|
|
||||||
return array(0 => 'a', 1 => 'b', 2 => 'c', 3 => 'd');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getIndices()
|
|
||||||
{
|
|
||||||
return array(0, 1, 2, 3);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,88 +0,0 @@
|
|||||||
<?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\Bridge\Doctrine\Tests\Form\ChoiceList;
|
|
||||||
|
|
||||||
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
|
|
||||||
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList;
|
|
||||||
use Doctrine\ORM\Tools\SchemaTool;
|
|
||||||
use Symfony\Component\Form\Tests\Extension\Core\ChoiceList\AbstractChoiceListTest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
|
||||||
*/
|
|
||||||
abstract class AbstractEntityChoiceListTest extends AbstractChoiceListTest
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var \Doctrine\ORM\EntityManager
|
|
||||||
*/
|
|
||||||
protected $em;
|
|
||||||
|
|
||||||
protected $obj1;
|
|
||||||
|
|
||||||
protected $obj2;
|
|
||||||
|
|
||||||
protected $obj3;
|
|
||||||
|
|
||||||
protected $obj4;
|
|
||||||
|
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
$this->em = DoctrineTestHelper::createTestEntityManager();
|
|
||||||
|
|
||||||
$schemaTool = new SchemaTool($this->em);
|
|
||||||
$classes = $this->getClassesMetadata();
|
|
||||||
|
|
||||||
try {
|
|
||||||
$schemaTool->dropSchema($classes);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$schemaTool->createSchema($classes);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
list($this->obj1, $this->obj2, $this->obj3, $this->obj4) = $this->createObjects();
|
|
||||||
|
|
||||||
$this->em->persist($this->obj1);
|
|
||||||
$this->em->persist($this->obj2);
|
|
||||||
$this->em->persist($this->obj3);
|
|
||||||
$this->em->persist($this->obj4);
|
|
||||||
$this->em->flush();
|
|
||||||
|
|
||||||
parent::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
|
|
||||||
$this->em = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract protected function getEntityClass();
|
|
||||||
|
|
||||||
abstract protected function createObjects();
|
|
||||||
|
|
||||||
protected function getClassesMetadata()
|
|
||||||
{
|
|
||||||
return array($this->em->getClassMetadata($this->getEntityClass()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface
|
|
||||||
*/
|
|
||||||
protected function createChoiceList()
|
|
||||||
{
|
|
||||||
return new EntityChoiceList($this->em, $this->getEntityClass());
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user