Inheritance2Test.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace Gedmo\Sluggable;
  3. use Doctrine\Common\EventManager;
  4. use Tool\BaseTestCaseORM;
  5. use Sluggable\Fixture\Inheritance2\SportCar;
  6. use Sluggable\Fixture\Inheritance2\Car;
  7. use Sluggable\Fixture\Inheritance2\Vehicle;
  8. /**
  9. * Tests for Sluggable behavior
  10. *
  11. */
  12. class Inheritance2Test extends BaseTestCaseORM
  13. {
  14. const VEHICLE = 'Sluggable\\Fixture\\Inheritance2\\Vehicle';
  15. const CAR = 'Sluggable\\Fixture\\Inheritance2\\Car';
  16. const SPORTCAR = 'Sluggable\\Fixture\\Inheritance2\\SportCar';
  17. protected function setUp()
  18. {
  19. parent::setUp();
  20. $evm = new EventManager;
  21. $evm->addEventSubscriber(new SluggableListener);
  22. $this->getMockSqliteEntityManager($evm);
  23. }
  24. public function testSlugGeneration()
  25. {
  26. $audi = new Car;
  27. $audi->setDescription('audi car');
  28. $audi->setTitle('Audi');
  29. $this->em->persist($audi);
  30. $audi2 = new Car;
  31. $audi2->setDescription('audi2 car');
  32. $audi2->setTitle('Audi');
  33. $this->em->persist($audi2);
  34. $audi3 = new SportCar;
  35. $audi3->setDescription('audi3 car');
  36. $audi3->setTitle('Audi');
  37. $this->em->persist($audi3);
  38. $this->em->flush();
  39. }
  40. protected function getUsedEntityFixtures()
  41. {
  42. return array(
  43. self::VEHICLE,
  44. self::CAR,
  45. self::SPORTCAR
  46. );
  47. }
  48. }