Code Duplication    Length = 14-14 lines in 5 locations

tests/Repository/EntitySpecificationRepositorySpec.php 5 locations

@@ 146-159 (lines=14) @@
143
        $this->matchSingleResult($specification)->shouldReturn($singleResult);
144
    }
145
146
    public function it_throws_exception_when_expecting_single_result_finding_none_without_result_modifier(
147
        Specification $specification,
148
        EntityManager $entityManager,
149
        QueryBuilder $qb,
150
        AbstractQuery $query
151
    ): void {
152
        $this->prepareStubs($specification, $entityManager, $qb, $query);
153
154
        $specification->modify($qb, $this->alias)->shouldBeCalled();
155
156
        $query->getSingleResult()->willThrow(new DoctrineNoResultException());
157
158
        $this->shouldThrow(NoResultException::class)->duringMatchSingleResult($specification);
159
    }
160
161
    public function it_throws_exception_when_expecting_single_result_finding_multiple_without_result_modifier(
162
        Specification $specification,
@@ 161-174 (lines=14) @@
158
        $this->shouldThrow(NoResultException::class)->duringMatchSingleResult($specification);
159
    }
160
161
    public function it_throws_exception_when_expecting_single_result_finding_multiple_without_result_modifier(
162
        Specification $specification,
163
        EntityManager $entityManager,
164
        QueryBuilder $qb,
165
        AbstractQuery $query
166
    ): void {
167
        $this->prepareStubs($specification, $entityManager, $qb, $query);
168
169
        $specification->modify($qb, $this->alias)->shouldBeCalled();
170
171
        $query->getSingleResult()->willThrow(new DoctrineNonUniqueResultException());
172
173
        $this->shouldThrow(NonUniqueResultException::class)->duringMatchSingleResult($specification);
174
    }
175
176
    public function it_matches_a_single_scalar_result_without_result_modifier(
177
        Specification $specification,
@@ 193-206 (lines=14) @@
190
        $this->matchSingleScalarResult($specification)->shouldReturn($singleScalarResult);
191
    }
192
193
    public function it_throws_exception_when_expecting_single_scalar_result_finding_multiple_without_result_modifier(
194
        Specification $specification,
195
        EntityManager $entityManager,
196
        QueryBuilder $qb,
197
        AbstractQuery $query
198
    ): void {
199
        $this->prepareStubs($specification, $entityManager, $qb, $query);
200
201
        $specification->modify($qb, $this->alias)->shouldBeCalled();
202
203
        $query->getSingleScalarResult()->willThrow(new DoctrineNonUniqueResultException());
204
205
        $this->shouldThrow(NonUniqueResultException::class)->duringMatchSingleScalarResult($specification);
206
    }
207
208
    public function it_matches_a_scalar_result_when_expecting_one_or_null_without_result_modifier(
209
        Specification $specification,
@@ 242-255 (lines=14) @@
239
        $this->matchOneOrNullResult($specification)->shouldReturn($singleResult);
240
    }
241
242
    public function it_matches_null_when_expecting_one_or_null_without_result_modifier(
243
        Specification $specification,
244
        EntityManager $entityManager,
245
        QueryBuilder $qb,
246
        AbstractQuery $query
247
    ): void {
248
        $this->prepareStubs($specification, $entityManager, $qb, $query);
249
250
        $specification->modify($qb, $this->alias)->shouldBeCalled();
251
252
        $query->getSingleResult()->willThrow(new DoctrineNonUniqueResultException());
253
254
        $this->shouldThrow(NonUniqueResultException::class)->duringMatchOneOrNullResult($specification);
255
    }
256
257
    public function it_throws_exception_when_expecting_one_or_null_finding_multiple_without_result_modifier(
258
        Specification $specification,
@@ 257-270 (lines=14) @@
254
        $this->shouldThrow(NonUniqueResultException::class)->duringMatchOneOrNullResult($specification);
255
    }
256
257
    public function it_throws_exception_when_expecting_one_or_null_finding_multiple_without_result_modifier(
258
        Specification $specification,
259
        EntityManager $entityManager,
260
        QueryBuilder $qb,
261
        AbstractQuery $query
262
    ): void {
263
        $this->prepareStubs($specification, $entityManager, $qb, $query);
264
265
        $specification->modify($qb, $this->alias)->shouldBeCalled();
266
267
        $query->getSingleResult()->willThrow(new DoctrineNonUniqueResultException());
268
269
        $this->shouldThrow(UnexpectedResultException::class)->duringMatchOneOrNullResult($specification);
270
    }
271
272
    public function it_matches_a_specification_with_result_modifier(
273
        Specification $specification,