2323#[CoversClass(DoctrineBatchWriterTask::class)]
2424class DoctrineBatchWriterTaskTest extends TestCase
2525{
26+ /**
27+ * @param array<string, mixed> $options
28+ */
2629 protected function getTask (array $ options = [], ?ManagerRegistry $ managerRegistry = null ): DoctrineBatchWriterTask
2730 {
28- if (!$ managerRegistry instanceof \ Doctrine \ Persistence \ ManagerRegistry) {
31+ if (!$ managerRegistry instanceof ManagerRegistry) {
2932 $ managerRegistry = $ this ->createStub (ManagerRegistry::class);
3033 }
3134 $ task = new DoctrineBatchWriterTask ($ managerRegistry );
@@ -50,8 +53,8 @@ public function testExecuteAddsEntityToBatchAndSkipsWhenBatchCountNotReached():
5053
5154 $ reflection = new \ReflectionClass (DoctrineBatchWriterTask::class);
5255 $ batchProperty = $ reflection ->getProperty ('batch ' );
53- $ this ->assertCount (1 , $ batchProperty ->getValue ($ task ));
54- $ this ->assertContains ($ entity1 , $ batchProperty ->getValue ($ task ));
56+ $ this ->assertCount (1 , ( array ) $ batchProperty ->getValue ($ task ));
57+ $ this ->assertContains ($ entity1 , ( array ) $ batchProperty ->getValue ($ task ));
5558 }
5659
5760 public function testExecuteFlushesBatchWhenBatchCountReached (): void
@@ -77,12 +80,12 @@ public function testExecuteFlushesBatchWhenBatchCountReached(): void
7780 $ batchProperty = $ reflection ->getProperty ('batch ' );
7881 // Add first entity
7982 $ task ->execute ($ state ); // batch has 1 entity, not flushed
80- $ this ->assertCount (1 , $ batchProperty ->getValue ($ task ));
81- $ this ->assertContains ($ entity1 , $ batchProperty ->getValue ($ task ));
83+ $ this ->assertCount (1 , ( array ) $ batchProperty ->getValue ($ task ));
84+ $ this ->assertContains ($ entity1 , ( array ) $ batchProperty ->getValue ($ task ));
8285
8386 // Add second entity, should trigger flush
8487 $ task ->execute ($ state ); // batch has 2 entities, should be flushed
85- $ this ->assertCount (0 , $ batchProperty ->getValue ($ task )); // Batch should be empty after flush
88+ $ this ->assertCount (0 , ( array ) $ batchProperty ->getValue ($ task )); // Batch should be empty after flush
8689 }
8790
8891 public function testFlushCallsWriteBatch (): void
@@ -160,7 +163,7 @@ public function testWriteBatchClearsBatchAfterFlushing(): void
160163 $ writeBatchMethod = $ reflection ->getMethod ('writeBatch ' );
161164 $ writeBatchMethod ->invoke ($ task , $ state );
162165
163- $ this ->assertCount (0 , $ batchProperty ->getValue ($ task )); // Batch should be empty
166+ $ this ->assertCount (0 , ( array ) $ batchProperty ->getValue ($ task )); // Batch should be empty
164167 }
165168
166169 public function testWriteBatchSetsOutput (): void
0 commit comments