MappedSuperclassTest.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. * @package Gedmo.Sluggable
  11. * @link http://www.gediminasm.org
  12. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  13. */
  14. class MappedSuperclassTest extends BaseTestCaseORM
  15. {
  16. const CAR = 'Sluggable\\Fixture\\MappedSuperclass\\Car';
  17. protected function setUp()
  18. {
  19. parent::setUp();
  20. }
  21. /**
  22. * If the MappedSuperclass doesn't have an identifier, SluggableListener generates a notice
  23. * Undefined offset: 0 in Doctrine/ORM/Mapping/ClassMetadataInfo.php:986
  24. * @test
  25. */
  26. public function shouldntGenerateNotice()
  27. {
  28. $evm = new EventManager;
  29. $evm->addEventSubscriber(new SluggableListener);
  30. $this->getMockSqliteEntityManager($evm);
  31. $audi = new Car;
  32. $audi->setDescription('audi car');
  33. $audi->setTitle('Audi');
  34. $this->em->persist($audi);
  35. $this->em->flush();
  36. }
  37. protected function getUsedEntityFixtures()
  38. {
  39. return array(
  40. self::CAR
  41. );
  42. }
  43. }