MappedSuperclassTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace Gedmo\Sluggable;
  3. use Doctrine\Common\EventManager;
  4. use Tool\BaseTestCaseORM;
  5. use Sluggable\Fixture\MappedSuperclass\Car;
  6. /**
  7. * These are tests for sluggable behavior
  8. *
  9. * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  10. * @link http://www.gediminasm.org
  11. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  12. */
  13. class MappedSuperclassTest extends BaseTestCaseORM
  14. {
  15. const CAR = 'Sluggable\\Fixture\\MappedSuperclass\\Car';
  16. protected function setUp()
  17. {
  18. parent::setUp();
  19. }
  20. /**
  21. * If the MappedSuperclass doesn't have an identifier, SluggableListener generates a notice
  22. * Undefined offset: 0 in Doctrine/ORM/Mapping/ClassMetadataInfo.php:986
  23. * @test
  24. */
  25. public function shouldntGenerateNotice()
  26. {
  27. $evm = new EventManager;
  28. $evm->addEventSubscriber(new SluggableListener);
  29. $this->getMockSqliteEntityManager($evm);
  30. $audi = new Car;
  31. $audi->setDescription('audi car');
  32. $audi->setTitle('Audi');
  33. $this->em->persist($audi);
  34. $this->em->flush();
  35. }
  36. protected function getUsedEntityFixtures()
  37. {
  38. return array(
  39. self::CAR
  40. );
  41. }
  42. }