public function EventDispatcherCollectionTest::testAlterQueueLoadedPaymentIds in Payment 8.2
@covers ::alterQueueLoadedPaymentIds @covers ::addEventDispatcher
File
- tests/
src/ Unit/ EventDispatcherCollectionTest.php, line 49
Class
- EventDispatcherCollectionTest
- @coversDefaultClass \Drupal\payment\EventDispatcherCollection
Namespace
Drupal\Tests\payment\UnitCode
public function testAlterQueueLoadedPaymentIds() {
$queue_id = $this
->randomMachineName();
$category_id = $this
->randomMachineName();
$owner_id = mt_rand();
$payment_ids = [
mt_rand(),
mt_rand(),
mt_rand(),
];
$payment_ids_a = [
mt_rand(),
mt_rand(),
mt_rand(),
];
$payment_ids_b = [
mt_rand(),
mt_rand(),
mt_rand(),
];
$event_dispatcher_a = $this
->createMock(EventDispatcherInterface::class);
$event_dispatcher_a
->expects($this
->atLeastOnce())
->method('alterQueueLoadedPaymentIds')
->with($queue_id, $category_id, $owner_id, $payment_ids)
->willReturn($payment_ids_a);
$event_dispatcher_b = $this
->createMock(EventDispatcherInterface::class);
$event_dispatcher_b
->expects($this
->atLeastOnce())
->method('alterQueueLoadedPaymentIds')
->with($queue_id, $category_id, $owner_id, $payment_ids_a)
->willReturn($payment_ids_b);
$this->sut
->addEventDispatcher($event_dispatcher_a);
$this->sut
->addEventDispatcher($event_dispatcher_b);
$this
->assertSame($payment_ids_b, $this->sut
->alterQueueLoadedPaymentIds($queue_id, $category_id, $owner_id, $payment_ids));
}