| @@ 1405-1416 (lines=12) @@ | ||
| 1402 | ->shouldReturn([3, 3]); |
|
| 1403 | } |
|
| 1404 | ||
| 1405 | function it_can_pluck_array() |
|
| 1406 | { |
|
| 1407 | $this->beConstructedWith([ |
|
| 1408 | ['id' => 1, 'name' => 'sth'], |
|
| 1409 | ['id' => 2, 'name' => 'sth'], |
|
| 1410 | ['id' => 3, 'name' => 'sth'], |
|
| 1411 | ]); |
|
| 1412 | $this |
|
| 1413 | ->pluck('id') |
|
| 1414 | ->toArray() |
|
| 1415 | ->shouldReturn([1, 2, 3]); |
|
| 1416 | } |
|
| 1417 | ||
| 1418 | function it_can_pluck_object() |
|
| 1419 | { |
|
| @@ 1418-1429 (lines=12) @@ | ||
| 1415 | ->shouldReturn([1, 2, 3]); |
|
| 1416 | } |
|
| 1417 | ||
| 1418 | function it_can_pluck_object() |
|
| 1419 | { |
|
| 1420 | $this->beConstructedWith([ |
|
| 1421 | (object)['id' => 1, 'name' => 'sth'], |
|
| 1422 | (object)['id' => 2, 'name' => 'else'], |
|
| 1423 | (object)['id' => 3, 'name' => 'other'], |
|
| 1424 | ]); |
|
| 1425 | $this |
|
| 1426 | ->pluck('name') |
|
| 1427 | ->toArray() |
|
| 1428 | ->shouldReturn(['sth', 'else', 'other']); |
|
| 1429 | } |
|
| 1430 | } |
|
| 1431 | ||