public function testHasLineItemWithState(LineItemCollection
$collection, array
$expectedResults): void
{ foreach ($expectedResults as $state =>
$expected) { static::
assertSame($expected,
$collection->
hasLineItemWithState($state), 'Line item of state `' .
$state . '` could not be found.'
);
} } public static function lineItemStateProvider(): \Generator
{ yield 'collection has line item with state download and physical' =>
[ new LineItemCollection([ (new LineItem('A', 'test'
))->
setStates([State::IS_PHYSICAL
]),
(new LineItem('B', 'test'
))->
setStates([State::IS_DOWNLOAD
]),
]),
[State::IS_PHYSICAL => true, State::IS_DOWNLOAD => true
],
];
yield 'collection has line item with only state physical' =>
[ new LineItemCollection([ (new LineItem('A', 'test'
))->
setStates([State::IS_PHYSICAL
]),
(new LineItem('B', 'test'
))->
setStates([State::IS_PHYSICAL
]),
]),
[State::IS_PHYSICAL => true, State::IS_DOWNLOAD => false
],
];