Code Duplication    Length = 32-32 lines in 2 locations

tests/unit/Service/QueueRequeueServiceTest.php 1 location

@@ 79-110 (lines=32) @@
76
        ];
77
    }
78
79
    public function testRestoreQueuesFailed(): void
80
    {
81
        $mockQueueService = $this->getMockQueueService(
82
            [
83
                'getToRestore',
84
                'beginTransaction',
85
                'commit',
86
                'flush',
87
                'isTransactionActive',
88
                'rollback',
89
            ]
90
        );
91
        $mockQueueService
92
            ->expects($this->once())
93
            ->method('beginTransaction');
94
        $mockQueueService
95
            ->expects($this->never())
96
            ->method('commit');
97
        $mockQueueService
98
            ->expects($this->never())
99
            ->method('flush');
100
        $mockQueueService
101
            ->expects($this->once())
102
            ->method('rollback');
103
        $mockQueueService
104
            ->expects($this->once())
105
            ->method('getToRestore')
106
            ->will($this->throwException(new \Exception('Something broken')));
107
        $queueRequeueService = $this->createService($this->getMockPublisherFactory(), $mockQueueService);
108
109
        $this->assertFalse($queueRequeueService->restoreQueues(5));
110
    }
111
112
    /**
113
     * @param QueueEntityInterface $queue

tests/unit/Service/QueueRepublishServiceTest.php 1 location

@@ 152-183 (lines=32) @@
149
        ];
150
    }
151
152
    public function testRestoreQueuesFailed(): void
153
    {
154
        $mockQueueService = $this->getMockQueueService(
155
            [
156
                'getToRepublish',
157
                'beginTransaction',
158
                'commit',
159
                'flush',
160
                'isTransactionActive',
161
                'rollback',
162
            ]
163
        );
164
        $mockQueueService
165
            ->expects($this->once())
166
            ->method('beginTransaction');
167
        $mockQueueService
168
            ->expects($this->never())
169
            ->method('commit');
170
        $mockQueueService
171
            ->expects($this->never())
172
            ->method('flush');
173
        $mockQueueService
174
            ->expects($this->once())
175
            ->method('rollback');
176
        $mockQueueService
177
            ->expects($this->once())
178
            ->method('getToRepublish')
179
            ->will($this->throwException(new \Exception('Something broken')));
180
        $queueRepublishService = $this->createService($this->getMockPublisherFactory(), $mockQueueService);
181
182
        $this->assertFalse($queueRepublishService->republishQueues(5));
183
    }
184
185
    /**
186
     * @param string $jobName