Skip to content
Snippets Groups Projects
Commit 100108b0 authored by Adrian Lorenc's avatar Adrian Lorenc
Browse files

ISAICP-9063: Mock queue.

parent ec5a524e
No related branches found
No related tags found
1 merge request!190Release v1.113.0
......@@ -5,6 +5,8 @@
namespace Drupal\Tests\eu_oss_catalogue\Kernel;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Queue\QueueFactory;
use Drupal\Core\Queue\QueueInterface;
use Drupal\KernelTests\KernelTestBase;
/**
......@@ -66,6 +68,21 @@ public function testCronPeriodicalTask(): void {
// Replace the real DrupalDateTime class with the mocked one.
$this->container->set('datetime.time', $mocked_time);
// Mock queue to check if correct arguments were provided.
$mock_queue = $this->createMock(QueueInterface::class);
$mock_queue->expects($this->once())
->method('createQueue');
$mock_queue->expects($this->once())
->method('createItem')
->with(['provider' => 'developers_italia']);
$this->container->set('queue', $mock_queue);
$queue_factory = $this->createMock(QueueFactory::class);
$queue_factory->expects($this->any())
->method('get')
->with('eu_oss_catalogue_fetcher')
->willReturn($mock_queue);
$this->container->set('queue', $queue_factory);
// And I run cron.
$cron->run();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment