| @@ 108-140 (lines=33) @@ | ||
| 105 | /** |
|
| 106 | * Test find. |
|
| 107 | */ |
|
| 108 | public function testFind() |
|
| 109 | { |
|
| 110 | parent::testFind(); |
|
| 111 | ||
| 112 | $this |
|
| 113 | ->given( |
|
| 114 | $unique = $this->uniqueValue(), |
|
| 115 | $criteria = Criteria::same($unique), |
|
| 116 | $emptyCollection = $this->emptyCollection() |
|
| 117 | ) |
|
| 118 | ->when($emptyCollection->set('foo', $unique)) |
|
| 119 | ->and($findResult = $emptyCollection->find($criteria)) |
|
| 120 | ->then() |
|
| 121 | ->hashmap($findResult) |
|
| 122 | ->size() |
|
| 123 | ->isEqualTo(1) |
|
| 124 | ->array($findResult->toArray()) |
|
| 125 | ->contains($unique) |
|
| 126 | ; |
|
| 127 | ||
| 128 | $this |
|
| 129 | ->given( |
|
| 130 | $unique = $this->uniqueValue(), |
|
| 131 | $criteria = Criteria::same($unique), |
|
| 132 | $randomCollection = $this->randomCollection() |
|
| 133 | ) |
|
| 134 | ->when($randomCollection->set('bar', $unique)) |
|
| 135 | ->and($findResult = $randomCollection->find($criteria)) |
|
| 136 | ->then() |
|
| 137 | ->array($findResult->toArray()) |
|
| 138 | ->contains($unique) |
|
| 139 | ; |
|
| 140 | } |
|
| 141 | } |
|
| 142 | ||
| @@ 163-195 (lines=33) @@ | ||
| 160 | /** |
|
| 161 | * Test find. |
|
| 162 | */ |
|
| 163 | public function testFind() |
|
| 164 | { |
|
| 165 | parent::testFind(); |
|
| 166 | ||
| 167 | $this |
|
| 168 | ->given( |
|
| 169 | $unique = $this->uniqueValue(), |
|
| 170 | $criteria = Criteria::same($unique), |
|
| 171 | $emptyCollection = $this->emptyCollection() |
|
| 172 | ) |
|
| 173 | ->when($emptyCollection->add($unique)) |
|
| 174 | ->and($findResult = $emptyCollection->find($criteria)) |
|
| 175 | ->then() |
|
| 176 | ->list($findResult) |
|
| 177 | ->size() |
|
| 178 | ->isEqualTo(1) |
|
| 179 | ->array($findResult->toArray()) |
|
| 180 | ->contains($unique) |
|
| 181 | ; |
|
| 182 | ||
| 183 | $this |
|
| 184 | ->given( |
|
| 185 | $unique = $this->uniqueValue(), |
|
| 186 | $criteria = Criteria::same($unique), |
|
| 187 | $randomCollection = $this->randomCollection() |
|
| 188 | ) |
|
| 189 | ->when($randomCollection->add($unique)) |
|
| 190 | ->and($findResult = $randomCollection->find($criteria)) |
|
| 191 | ->then() |
|
| 192 | ->array($findResult->toArray()) |
|
| 193 | ->contains($unique) |
|
| 194 | ; |
|
| 195 | } |
|
| 196 | ||
| 197 | /** |
|
| 198 | * Test findOne. |
|
| @@ 181-213 (lines=33) @@ | ||
| 178 | /** |
|
| 179 | * Test find. |
|
| 180 | */ |
|
| 181 | public function testFind() |
|
| 182 | { |
|
| 183 | parent::testFind(); |
|
| 184 | ||
| 185 | $this |
|
| 186 | ->given( |
|
| 187 | $unique = $this->uniqueValue(), |
|
| 188 | $criteria = Criteria::same($unique), |
|
| 189 | $emptyCollection = $this->emptyCollection() |
|
| 190 | ) |
|
| 191 | ->when($emptyCollection->add($unique)) |
|
| 192 | ->and($findResult = $emptyCollection->find($criteria)) |
|
| 193 | ->then() |
|
| 194 | ->set($findResult) |
|
| 195 | ->size() |
|
| 196 | ->isEqualTo(1) |
|
| 197 | ->array($findResult->toArray()) |
|
| 198 | ->contains($unique) |
|
| 199 | ; |
|
| 200 | ||
| 201 | $this |
|
| 202 | ->given( |
|
| 203 | $unique = $this->uniqueValue(), |
|
| 204 | $criteria = Criteria::same($unique), |
|
| 205 | $randomCollection = $this->randomCollection() |
|
| 206 | ) |
|
| 207 | ->when($randomCollection->add($unique)) |
|
| 208 | ->and($findResult = $randomCollection->find($criteria)) |
|
| 209 | ->then() |
|
| 210 | ->array($findResult->toArray()) |
|
| 211 | ->contains($unique) |
|
| 212 | ; |
|
| 213 | } |
|
| 214 | ||
| 215 | /** |
|
| 216 | * Test findOne. |
|