InheritanceTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace Gedmo\Sluggable;
  3. use Doctrine\Common\EventManager;
  4. use Tool\BaseTestCaseORM;
  5. use Sluggable\Fixture\Inheritance\Car;
  6. use Sluggable\Fixture\Inheritance\Vehicle;
  7. /**
  8. * These are tests for Sluggable behavior
  9. *
  10. * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  11. * @link http://www.gediminasm.org
  12. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  13. */
  14. class InheritanceTest extends BaseTestCaseORM
  15. {
  16. const VEHICLE = 'Sluggable\\Fixture\\Inheritance\\Vehicle';
  17. const CAR = 'Sluggable\\Fixture\\Inheritance\\Car';
  18. protected function setUp()
  19. {
  20. parent::setUp();
  21. $evm = new EventManager;
  22. $evm->addEventSubscriber(new SluggableListener);
  23. $this->getMockSqliteEntityManager($evm);
  24. }
  25. public function testSlugGeneration()
  26. {
  27. $audi = new Car;
  28. $audi->setDescription('audi car');
  29. $audi->setTitle('Audi');
  30. $this->em->persist($audi);
  31. $audi2 = new Car;
  32. $audi2->setDescription('audi2 car');
  33. $audi2->setTitle('Audi');
  34. $this->em->persist($audi2);
  35. $audi3 = new Vehicle;
  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. );
  46. }
  47. }