NoInterfaceTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. * @link http://www.gediminasm.org
  12. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  13. */
  14. class NoInterfaceTest extends BaseTestCaseORM
  15. {
  16. const FIXTURE = "Blameable\\Fixture\\Entity\\WithoutInterface";
  17. protected function setUp()
  18. {
  19. parent::setUp();
  20. $evm = new EventManager;
  21. $blameableListener = new BlameableListener;
  22. $blameableListener->setUserValue('testuser');
  23. $evm->addEventSubscriber($blameableListener);
  24. $this->getMockSqliteEntityManager($evm);
  25. }
  26. public function testBlameableNoInterface()
  27. {
  28. $test = new WithoutInterface();
  29. $test->setTitle('Test');
  30. $this->em->persist($test);
  31. $this->em->flush();
  32. $this->em->clear();
  33. $test = $this->em->getRepository(self::FIXTURE)->findOneByTitle('Test');
  34. $this->assertEquals('testuser', $test->getCreated());
  35. $this->assertEquals('testuser', $test->getUpdated());
  36. }
  37. protected function getUsedEntityFixtures()
  38. {
  39. return array(
  40. self::FIXTURE,
  41. );
  42. }
  43. }