@@ -52,9 +52,7 @@ protected function setUp(): void
5252
5353 public function testDefaultSettings (): void
5454 {
55- $ blockService = $ this ->getMockForAbstractClass (AbstractCollectionsBlockService::class, [
56- $ this ->twig , $ this ->contextManager , $ this ->collectionManager , $ this ->collectionAdmin ,
57- ]);
55+ $ blockService = new class ($ this ->twig , $ this ->contextManager , $ this ->collectionManager , $ this ->collectionAdmin ) extends AbstractCollectionsBlockService {};
5856 $ blockContext = $ this ->getBlockContext ($ blockService );
5957
6058 $ this ->assertSettings ([
@@ -71,9 +69,7 @@ public function testDefaultSettings(): void
7169
7270 public function testLoad (): void
7371 {
74- $ collection = $ this ->getMockBuilder (CollectionInterface::class)
75- ->disableOriginalConstructor ()
76- ->getMockForAbstractClass ();
72+ $ collection = $ this ->createMock (CollectionInterface::class);
7773 $ collection ->expects (static ::any ())->method ('getId ' )->willReturn (23 );
7874
7975 $ this ->collectionManager ->expects (static ::any ())
@@ -90,17 +86,13 @@ public function testLoad(): void
9086 ->method ('setSetting ' )
9187 ->with (static ::equalTo ('collectionId ' ), static ::equalTo ($ collection ));
9288
93- $ blockService = $ this ->getMockForAbstractClass (AbstractCollectionsBlockService::class, [
94- $ this ->twig , $ this ->contextManager , $ this ->collectionManager , $ this ->collectionAdmin ,
95- ]);
89+ $ blockService = new class ($ this ->twig , $ this ->contextManager , $ this ->collectionManager , $ this ->collectionAdmin ) extends AbstractCollectionsBlockService {};
9690 $ blockService ->load ($ block );
9791 }
9892
9993 public function testPrePersist (): void
10094 {
101- $ collection = $ this ->getMockBuilder (CollectionInterface::class)
102- ->disableOriginalConstructor ()
103- ->getMockForAbstractClass ();
95+ $ collection = $ this ->createMock (CollectionInterface::class);
10496 $ collection ->expects (static ::any ())->method ('getId ' )->willReturn (23 );
10597
10698 $ block = $ this ->createMock (BlockInterface::class);
@@ -112,17 +104,13 @@ public function testPrePersist(): void
112104 ->method ('setSetting ' )
113105 ->with (static ::equalTo ('collectionId ' ), static ::equalTo (23 ));
114106
115- $ blockService = $ this ->getMockForAbstractClass (AbstractCollectionsBlockService::class, [
116- $ this ->twig , $ this ->contextManager , $ this ->collectionManager , $ this ->collectionAdmin ,
117- ]);
107+ $ blockService = new class ($ this ->twig , $ this ->contextManager , $ this ->collectionManager , $ this ->collectionAdmin ) extends AbstractCollectionsBlockService {};
118108 $ blockService ->prePersist ($ block );
119109 }
120110
121111 public function testPreUpdate (): void
122112 {
123- $ collection = $ this ->getMockBuilder (CollectionInterface::class)
124- ->disableOriginalConstructor ()
125- ->getMockForAbstractClass ();
113+ $ collection = $ this ->createMock (CollectionInterface::class);
126114 $ collection ->expects (static ::any ())->method ('getId ' )->willReturn (23 );
127115
128116 $ block = $ this ->createMock (BlockInterface::class);
@@ -134,9 +122,7 @@ public function testPreUpdate(): void
134122 ->method ('setSetting ' )
135123 ->with (static ::equalTo ('collectionId ' ), static ::equalTo (23 ));
136124
137- $ blockService = $ this ->getMockForAbstractClass (AbstractCollectionsBlockService::class, [
138- $ this ->twig , $ this ->contextManager , $ this ->collectionManager , $ this ->collectionAdmin ,
139- ]);
125+ $ blockService = new class ($ this ->twig , $ this ->contextManager , $ this ->collectionManager , $ this ->collectionAdmin ) extends AbstractCollectionsBlockService {};
140126 $ blockService ->preUpdate ($ block );
141127 }
142128}
0 commit comments