|
@@ 121-136 (lines=16) @@
|
| 118 |
|
$this->match($specification)->shouldReturn($this->result); |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
public function it_matches_a_single_result_without_result_modifier( |
| 122 |
|
Specification $specification, |
| 123 |
|
EntityManager $entityManager, |
| 124 |
|
QueryBuilder $qb, |
| 125 |
|
AbstractQuery $query |
| 126 |
|
) { |
| 127 |
|
$singleResult = new \stdClass(); |
| 128 |
|
|
| 129 |
|
$this->prepareStubs($specification, $entityManager, $qb, $query); |
| 130 |
|
|
| 131 |
|
$specification->modify($qb, $this->alias)->shouldBeCalled(); |
| 132 |
|
|
| 133 |
|
$query->getSingleResult()->willReturn($singleResult); |
| 134 |
|
|
| 135 |
|
$this->matchSingleResult($specification)->shouldReturn($singleResult); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
public function it_throws_exception_when_expecting_single_result_finding_none_without_result_modifier( |
| 139 |
|
Specification $specification, |
|
@@ 168-183 (lines=16) @@
|
| 165 |
|
$this->shouldThrow('Happyr\DoctrineSpecification\Exception\NonUniqueResultException')->duringMatchSingleResult($specification); |
| 166 |
|
} |
| 167 |
|
|
| 168 |
|
public function it_matches_a_single_result_when_expecting_one_or_null_without_result_modifier( |
| 169 |
|
Specification $specification, |
| 170 |
|
EntityManager $entityManager, |
| 171 |
|
QueryBuilder $qb, |
| 172 |
|
AbstractQuery $query |
| 173 |
|
) { |
| 174 |
|
$singleResult = new \stdClass(); |
| 175 |
|
|
| 176 |
|
$this->prepareStubs($specification, $entityManager, $qb, $query); |
| 177 |
|
|
| 178 |
|
$specification->modify($qb, $this->alias)->shouldBeCalled(); |
| 179 |
|
|
| 180 |
|
$query->getSingleResult()->willReturn($singleResult); |
| 181 |
|
|
| 182 |
|
$this->matchOneOrNullResult($specification)->shouldReturn($singleResult); |
| 183 |
|
} |
| 184 |
|
|
| 185 |
|
public function it_matches_null_when_expecting_one_or_null_without_result_modifier( |
| 186 |
|
Specification $specification, |