Issue131Test.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace Gedmo\Sluggable;
  3. use Doctrine\Common\EventManager;
  4. use Tool\BaseTestCaseORM;
  5. use Sluggable\Fixture\Issue131\Article;
  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 Issue131Test extends BaseTestCaseORM
  14. {
  15. const TARGET = 'Sluggable\\Fixture\\Issue131\\Article';
  16. protected function setUp()
  17. {
  18. parent::setUp();
  19. $evm = new EventManager;
  20. $evm->addEventSubscriber(new SluggableListener);
  21. $this->getMockSqliteEntityManager($evm);
  22. }
  23. public function testSlugGeneration()
  24. {
  25. $test = new Article;
  26. $test->setTitle('');
  27. $this->em->persist($test);
  28. $this->em->flush();
  29. $this->assertNull($test->getSlug());
  30. $test2 = new Article;
  31. $test2->setTitle('');
  32. $this->em->persist($test2);
  33. $this->em->flush();
  34. $this->assertNull($test2->getSlug());
  35. }
  36. protected function getUsedEntityFixtures()
  37. {
  38. return array(
  39. self::TARGET
  40. );
  41. }
  42. }