22
33namespace Doctrine \Tests \ORM \Functional ;
44
5+ use Doctrine \ORM \Event \LifecycleEventArgs ;
56use Doctrine \Tests \Models \Company \CompanyContractListener ;
67use Doctrine \Tests \Models \Company \CompanyFixContract ;
78use Doctrine \Tests \Models \DDC3597 \DDC3597Image ;
89use Doctrine \Tests \Models \DDC3597 \DDC3597Media ;
910use Doctrine \Tests \Models \DDC3597 \DDC3597Root ;
11+ use Doctrine \Tests \OrmFunctionalTestCase ;
1012
1113/**
1214 * @group DDC-1955
1315 * @group 5570
1416 * @group 6174
1517 */
16- class EntityListenersOnMergeTest extends \ Doctrine \ Tests \ OrmFunctionalTestCase
18+ class EntityListenersOnMergeTest extends OrmFunctionalTestCase
1719{
18-
1920 /**
20- * @var \Doctrine\Tests\Models\Company\ CompanyContractListener
21+ * @var CompanyContractListener
2122 */
2223 private $ listener ;
2324
@@ -26,34 +27,32 @@ protected function setUp()
2627 $ this ->useModelSet ('company ' );
2728 parent ::setUp ();
2829
29- $ this ->_schemaTool ->createSchema (
30- [
31- $ this ->_em ->getClassMetadata (DDC3597Root::class),
32- $ this ->_em ->getClassMetadata (DDC3597Media::class),
33- $ this ->_em ->getClassMetadata (DDC3597Image::class),
34- ]
35- );
30+ $ this ->_schemaTool ->createSchema ([
31+ $ this ->_em ->getClassMetadata (DDC3597Root::class),
32+ $ this ->_em ->getClassMetadata (DDC3597Media::class),
33+ $ this ->_em ->getClassMetadata (DDC3597Image::class),
34+ ]);
3635
3736 $ this ->listener = $ this ->_em ->getConfiguration ()
3837 ->getEntityListenerResolver ()
39- ->resolve (' Doctrine\Tests\Models\Company\ CompanyContractListener' );
38+ ->resolve (CompanyContractListener::class );
4039 }
4140
4241 protected function tearDown ()
4342 {
4443 parent ::tearDown ();
45- $ this ->_schemaTool ->dropSchema (
46- [
47- $ this ->_em ->getClassMetadata (DDC3597Root::class),
48- $ this ->_em ->getClassMetadata (DDC3597Media::class),
49- $ this ->_em ->getClassMetadata (DDC3597Image::class),
50- ]
51- );
44+
45+ $ this ->_schemaTool ->dropSchema ([
46+ $ this ->_em ->getClassMetadata (DDC3597Root::class),
47+ $ this ->_em ->getClassMetadata (DDC3597Media::class),
48+ $ this ->_em ->getClassMetadata (DDC3597Image::class),
49+ ]);
5250 }
5351
5452 public function testMergeNewEntityLifecyleEventsModificationsShouldBeKept ()
5553 {
5654 $ imageEntity = new DDC3597Image ('foobar ' );
55+
5756 $ imageEntity ->setFormat ('JPG ' );
5857 $ imageEntity ->setSize (123 );
5958 $ imageEntity ->getDimension ()->setWidth (300 );
@@ -68,6 +67,7 @@ public function testMergeNewEntityLifecyleEventsModificationsShouldBeKept()
6867 public function testPrePersistListenersShouldBeFiredWithCorrectEntityData ()
6968 {
7069 $ fix = new CompanyFixContract ();
70+
7171 $ fix ->setFixPrice (2000 );
7272
7373 $ this ->listener ->prePersistCalls = [];
@@ -79,20 +79,13 @@ public function testPrePersistListenersShouldBeFiredWithCorrectEntityData()
7979
8080 $ this ->assertSame ($ fix , $ this ->listener ->prePersistCalls [0 ][0 ]);
8181
82- $ this ->assertInstanceOf (
83- 'Doctrine\Tests\Models\Company\CompanyFixContract ' ,
84- $ this ->listener ->prePersistCalls [0 ][0 ]
85- );
86-
87- $ this ->assertInstanceOf (
88- 'Doctrine\ORM\Event\LifecycleEventArgs ' ,
89- $ this ->listener ->prePersistCalls [0 ][1 ]
90- );
82+ $ this ->assertInstanceOf (CompanyFixContract::class, $ this ->listener ->prePersistCalls [0 ][0 ]);
83+ $ this ->assertInstanceOf (LifecycleEventArgs::class, $ this ->listener ->prePersistCalls [0 ][1 ]);
9184
9285 $ this ->assertArrayHasKey ('fixPrice ' , $ this ->listener ->snapshots [CompanyContractListener::PRE_PERSIST ][0 ]);
9386 $ this ->assertEquals (
9487 $ fix ->getFixPrice (),
9588 $ this ->listener ->snapshots [CompanyContractListener::PRE_PERSIST ][0 ]['fixPrice ' ]
9689 );
9790 }
98- }
91+ }
0 commit comments