| Conditions | 1 |
| Paths | 1 |
| Total Lines | 37 |
| Code Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | public function setIterableWithDeferTaskConfiguration(CliGuy $I) |
||
| 8 | { |
||
| 9 | $I->wantTo('set iterable with deferTaskConfiguration()'); |
||
| 10 | |||
| 11 | $expected = [ |
||
| 12 | 'a = b', |
||
| 13 | 'c = d', |
||
| 14 | 'e = f', |
||
| 15 | ]; |
||
| 16 | $actual = []; |
||
| 17 | $I |
||
| 18 | ->collectionBuilder() |
||
| 19 | ->addCode(function (\Robo\State\Data $data) { |
||
| 20 | $data['items'] = [ |
||
| 21 | 'a' => 'b', |
||
| 22 | 'c' => 'd', |
||
| 23 | 'e' => 'f', |
||
| 24 | ]; |
||
| 25 | |||
| 26 | return 0; |
||
| 27 | }) |
||
| 28 | ->addTask( |
||
| 29 | $I |
||
| 30 | ->taskForEach() |
||
| 31 | ->deferTaskConfiguration('setIterable', 'items') |
||
| 32 | ->withBuilder(function (CollectionBuilder $builder, $key, $value) use (&$actual) { |
||
| 33 | $builder->addCode(function () use ($key, $value, &$actual) { |
||
| 34 | $actual[] = "$key = $value"; |
||
| 35 | |||
| 36 | return 0; |
||
| 37 | }); |
||
| 38 | }) |
||
| 39 | ) |
||
| 40 | ->run(); |
||
| 41 | |||
| 42 | $I->assertEquals($expected, $actual); |
||
| 43 | } |
||
| 44 | } |
||
| 45 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.