Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / ORM / Functional / ClearEventTest.php
1 <?php
2
3 namespace Doctrine\Tests\ORM\Functional;
4
5 use Doctrine\ORM\Event\OnClearEventArgs;
6 use Doctrine\ORM\Events;
7
8 require_once __DIR__ . '/../../TestInit.php';
9
10 /**
11  * ClearEventTest
12  *
13  * @author Michael Ridgway <mcridgway@gmail.com>
14  */
15 class ClearEventTest extends \Doctrine\Tests\OrmFunctionalTestCase
16 {
17     protected function setUp() {
18         parent::setUp();
19     }
20
21     public function testEventIsCalledOnClear()
22     {
23         $listener = new OnClearListener;
24         $this->_em->getEventManager()->addEventListener(Events::onClear, $listener);
25
26         $this->_em->clear();
27
28         $this->assertTrue($listener->called);
29     }
30 }
31
32 class OnClearListener
33 {
34     public $called = false;
35
36     public function onClear(OnClearEventArgs $args)
37     {
38         $this->called = true;
39     }
40 }