X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FTests%2FSubscriber%2FTablePrefixSubscriberTest.php;h=e5eafab1a4f3f8d3f9cef42163680434f87fedae;hb=4094ea47712efbe58624ff74daeb1f77c9b0edcf;hp=4c138610965244563ee35185baf211341b12ed6a;hpb=735068d1814a4b7a688e1d19cd17b13e8c5da3eb;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Tests/Subscriber/TablePrefixSubscriberTest.php b/src/Wallabag/CoreBundle/Tests/Subscriber/TablePrefixSubscriberTest.php index 4c138610..e5eafab1 100644 --- a/src/Wallabag/CoreBundle/Tests/Subscriber/TablePrefixSubscriberTest.php +++ b/src/Wallabag/CoreBundle/Tests/Subscriber/TablePrefixSubscriberTest.php @@ -2,33 +2,32 @@ namespace Wallabag\CoreBundle\Tests\Subscriber; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\ORM\Event\LoadClassMetadataEventArgs; use Doctrine\Common\EventManager; +use Doctrine\ORM\Event\LoadClassMetadataEventArgs; +use Doctrine\ORM\Mapping\ClassMetadata; use Wallabag\CoreBundle\Subscriber\TablePrefixSubscriber; -class TablePrefixSubscriberTest extends KernelTestCase +class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase { public function dataForPrefix() { - return array( - array('wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), - array('wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '`wallabag_user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()), - array('wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()), - - array('wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), - array('wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\MySqlPlatform()), - array('wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\SqlitePlatform()), - - array('', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), - array('', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '`user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()), - array('', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()), - - array('', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), - array('', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\MySqlPlatform()), - array('', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\SqlitePlatform()), - ); + return [ + ['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()], + ['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '`wallabag_user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()], + ['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()], + + ['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()], + ['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\MySqlPlatform()], + ['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\SqlitePlatform()], + + ['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()], + ['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '`user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()], + ['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()], + + ['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()], + ['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\MySqlPlatform()], + ['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\SqlitePlatform()], + ]; } /** @@ -43,7 +42,7 @@ class TablePrefixSubscriberTest extends KernelTestCase $subscriber = new TablePrefixSubscriber($prefix); $metaClass = new ClassMetadata($entityName); - $metaClass->setPrimaryTable(array('name' => $tableName)); + $metaClass->setPrimaryTable(['name' => $tableName]); $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); @@ -65,7 +64,7 @@ class TablePrefixSubscriberTest extends KernelTestCase ->getMock(); $metaClass = new ClassMetadata($entityName); - $metaClass->setPrimaryTable(array('name' => $tableName)); + $metaClass->setPrimaryTable(['name' => $tableName]); $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); @@ -89,18 +88,18 @@ class TablePrefixSubscriberTest extends KernelTestCase $subscriber = new TablePrefixSubscriber('yo_'); $metaClass = new ClassMetadata('Wallabag\UserBundle\Entity\Entry'); - $metaClass->setPrimaryTable(array('name' => 'entry')); - $metaClass->mapManyToMany(array( + $metaClass->setPrimaryTable(['name' => 'entry']); + $metaClass->mapManyToMany([ 'fieldName' => 'tags', - 'joinTable' => array('name' => null, 'schema' => null), + 'joinTable' => ['name' => null, 'schema' => null], 'targetEntity' => 'Tag', 'mappedBy' => null, 'inversedBy' => 'entries', - 'cascade' => array('persist'), + 'cascade' => ['persist'], 'indexBy' => null, 'orphanRemoval' => false, 'fetch' => 2, - )); + ]); $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em);