You are here

protected function RadioactivityProcessorTest::setUp in Radioactivity 4.0.x

Same name and namespace in other branches
  1. 8.3 tests/src/Unit/RadioactivityProcessorTest.php \Drupal\Tests\radioactivity\Unit\RadioactivityProcessorTest::setUp()

Overrides UnitTestCase::setUp

File

tests/src/Unit/RadioactivityProcessorTest.php, line 117

Class

RadioactivityProcessorTest
@coversDefaultClass \Drupal\radioactivity\RadioactivityProcessor @group radioactivity

Namespace

Drupal\Tests\radioactivity\Unit

Code

protected function setUp() : void {
  parent::setUp();
  $this->entityTypeManager = $this
    ->prophesize(EntityTypeManager::class);
  $this->fieldStorageConfig = $this
    ->prophesize(EntityStorageInterface::class);
  $this->entityTypeManager
    ->getStorage('field_storage_config')
    ->willReturn($this->fieldStorageConfig
    ->reveal());
  $this->state = $this
    ->prophesize(StateInterface::class);
  $loggerFactory = $this
    ->prophesize(LoggerChannelFactoryInterface::class);
  $this->loggerChannel = $this
    ->prophesize(LoggerChannelInterface::class);
  $loggerFactory
    ->get(RadioactivityProcessorInterface::LOGGER_CHANNEL)
    ->willReturn($this->loggerChannel
    ->reveal());
  $this->storage = $this
    ->prophesize(StorageFactory::class);
  $this->incidentStorage = $this
    ->prophesize(IncidentStorageInterface::class);
  $this->storage
    ->getConfiguredStorage()
    ->willReturn($this->incidentStorage
    ->reveal());
  $time = $this
    ->prophesize(TimeInterface::class);
  $time
    ->getRequestTime()
    ->willReturn($this->requestTime);
  $this->queueFactory = $this
    ->prophesize(QueueFactory::class);
  $this->eventDispatcher = $this
    ->prophesize(EventDispatcherInterface::class);
  $this->sut = $this
    ->getMockBuilder(RadioactivityProcessor::class)
    ->onlyMethods([
    'getRadioactivityFieldsConfig',
  ])
    ->setConstructorArgs([
    $this->entityTypeManager
      ->reveal(),
    $this->state
      ->reveal(),
    $loggerFactory
      ->reveal(),
    $this->storage
      ->reveal(),
    $time
      ->reveal(),
    $this->queueFactory
      ->reveal(),
    $this->eventDispatcher
      ->reveal(),
  ])
    ->getMock();
}