NoInterfaceTest.php 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace Gedmo\Blameable;
  3. use Doctrine\Common\EventManager;
  4. use Tool\BaseTestCaseORM;
  5. use Doctrine\Common\Util\Debug,
  6. Blameable\Fixture\Entity\WithoutInterface;
  7. /**
  8. * These are tests for Blameable behavior
  9. *
  10. * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  11. * @package Gedmo.Blameable
  12. * @link http://www.gediminasm.org
  13. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  14. */
  15. class NoInterfaceTest extends BaseTestCaseORM
  16. {
  17. const FIXTURE = "Blameable\\Fixture\\Entity\\WithoutInterface";
  18. protected function setUp()
  19. {
  20. parent::setUp();
  21. $evm = new EventManager;
  22. $blameableListener = new BlameableListener;
  23. $blameableListener->setUserValue('testuser');
  24. $evm->addEventSubscriber($blameableListener);
  25. $this->getMockSqliteEntityManager($evm);
  26. }
  27. public function testBlameableNoInterface()
  28. {
  29. $test = new WithoutInterface();
  30. $test->setTitle('Test');
  31. $this->em->persist($test);
  32. $this->em->flush();
  33. $this->em->clear();
  34. $test = $this->em->getRepository(self::FIXTURE)->findOneByTitle('Test');
  35. $this->assertEquals('testuser', $test->getCreated());
  36. $this->assertEquals('testuser', $test->getUpdated());
  37. }
  38. protected function getUsedEntityFixtures()
  39. {
  40. return array(
  41. self::FIXTURE,
  42. );
  43. }
  44. }