ProtectedPropertySupperclassTest.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace Gedmo\Tree;
  3. use Doctrine\Common\EventManager;
  4. use Tool\BaseTestCaseORM;
  5. use Gedmo\Translatable\TranslatableListener;
  6. use Gedmo\Timestampable\TimestampableListener;
  7. use Doctrine\Common\Util\Debug;
  8. use Timestampable\Fixture\SupperClassExtension;
  9. /**
  10. * These are tests for Timestampable behavior
  11. *
  12. * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  13. * @link http://www.gediminasm.org
  14. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  15. */
  16. class ProtectedPropertySupperclassTest extends BaseTestCaseORM
  17. {
  18. const SUPERCLASS = "Timestampable\\Fixture\\SupperClassExtension";
  19. const TRANSLATION = "Gedmo\\Translatable\\Entity\\Translation";
  20. protected function setUp()
  21. {
  22. parent::setUp();
  23. $evm = new EventManager;
  24. $translatableListener = new TranslatableListener;
  25. $translatableListener->setTranslatableLocale('en_US');
  26. $evm->addEventSubscriber($translatableListener);
  27. $evm->addEventSubscriber(new TimestampableListener);
  28. $this->getMockSqliteEntityManager($evm);
  29. }
  30. public function testProtectedProperty()
  31. {
  32. $test = new SupperClassExtension;
  33. $test->setName('name');
  34. $test->setTitle('title');
  35. $this->em->persist($test);
  36. $this->em->flush();
  37. $this->em->clear();
  38. $repo = $this->em->getRepository(self::TRANSLATION);
  39. $translations = $repo->findTranslations($test);
  40. $this->assertCount(0, $translations);
  41. $this->assertNotNull($test->getCreatedAt());
  42. }
  43. protected function getUsedEntityFixtures()
  44. {
  45. return array(
  46. self::TRANSLATION,
  47. self::SUPERCLASS
  48. );
  49. }
  50. }