You are here

protected function RadioactivityFieldTypeTest::setUp in Radioactivity 4.0.x

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

Set the default field storage backend for fields created during tests.

Overrides FieldKernelTestBase::setUp

File

tests/src/Kernel/RadioactivityFieldTypeTest.php, line 50

Class

RadioactivityFieldTypeTest
@coversDefaultClass \Drupal\radioactivity\Plugin\Field\FieldType\RadioactivityField @group radioactivity

Namespace

Drupal\Tests\radioactivity\Kernel

Code

protected function setUp() : void {
  parent::setUp();

  // Mock Time::getRequestTime.
  $dateTime = $this
    ->getMockBuilder(TimeInterface::class)
    ->disableOriginalConstructor()
    ->getMock();
  $dateTime
    ->expects($this
    ->any())
    ->method('getRequestTime')
    ->willReturnCallback(function () {
    return $this->requestTime;
  });
  $this->container
    ->set('datetime.time', $dateTime);
}