@@ 129-144 (lines=16) @@ | ||
126 | $this->match($specification)->shouldReturn($this->result); |
|
127 | } |
|
128 | ||
129 | public function it_matches_a_single_result_without_result_modifier( |
|
130 | Specification $specification, |
|
131 | EntityManager $entityManager, |
|
132 | QueryBuilder $qb, |
|
133 | AbstractQuery $query |
|
134 | ): void { |
|
135 | $singleResult = new \stdClass(); |
|
136 | ||
137 | $this->prepareStubs($specification, $entityManager, $qb, $query); |
|
138 | ||
139 | $specification->modify($qb, $this->alias)->shouldBeCalled(); |
|
140 | ||
141 | $query->getSingleResult()->willReturn($singleResult); |
|
142 | ||
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, |
|
@@ 176-191 (lines=16) @@ | ||
173 | $this->shouldThrow(NonUniqueResultException::class)->duringMatchSingleResult($specification); |
|
174 | } |
|
175 | ||
176 | public function it_matches_a_single_scalar_result_without_result_modifier( |
|
177 | Specification $specification, |
|
178 | EntityManager $entityManager, |
|
179 | QueryBuilder $qb, |
|
180 | AbstractQuery $query |
|
181 | ): void { |
|
182 | $singleScalarResult = '1'; |
|
183 | ||
184 | $this->prepareStubs($specification, $entityManager, $qb, $query); |
|
185 | ||
186 | $specification->modify($qb, $this->alias)->shouldBeCalled(); |
|
187 | ||
188 | $query->getSingleScalarResult()->willReturn($singleScalarResult); |
|
189 | ||
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, |
|
@@ 225-240 (lines=16) @@ | ||
222 | $this->matchScalarResult($specification)->shouldReturn($scalarResult); |
|
223 | } |
|
224 | ||
225 | public function it_matches_a_single_result_when_expecting_one_or_null_without_result_modifier( |
|
226 | Specification $specification, |
|
227 | EntityManager $entityManager, |
|
228 | QueryBuilder $qb, |
|
229 | AbstractQuery $query |
|
230 | ): void { |
|
231 | $singleResult = new \stdClass(); |
|
232 | ||
233 | $this->prepareStubs($specification, $entityManager, $qb, $query); |
|
234 | ||
235 | $specification->modify($qb, $this->alias)->shouldBeCalled(); |
|
236 | ||
237 | $query->getSingleResult()->willReturn($singleResult); |
|
238 | ||
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, |