You are here

protected function ResponsiveImageStyleConfigEntityUnitTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php \Drupal\Tests\responsive_image\Unit\ResponsiveImageStyleConfigEntityUnitTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php, line 41

Class

ResponsiveImageStyleConfigEntityUnitTest
@coversDefaultClass \Drupal\responsive_image\Entity\ResponsiveImageStyle @group block

Namespace

Drupal\Tests\responsive_image\Unit

Code

protected function setUp() {
  $this->entityType = $this
    ->createMock('\\Drupal\\Core\\Entity\\EntityTypeInterface');
  $this->entityType
    ->expects($this
    ->any())
    ->method('getProvider')
    ->will($this
    ->returnValue('responsive_image'));
  $this->entityTypeManager = $this
    ->createMock(EntityTypeManagerInterface::class);
  $this->entityTypeManager
    ->expects($this
    ->any())
    ->method('getDefinition')
    ->with('responsive_image_style')
    ->will($this
    ->returnValue($this->entityType));
  $this->breakpointManager = $this
    ->createMock('\\Drupal\\breakpoint\\BreakpointManagerInterface');
  $container = new ContainerBuilder();
  $container
    ->set('entity_type.manager', $this->entityTypeManager);
  $container
    ->set('breakpoint.manager', $this->breakpointManager);
  \Drupal::setContainer($container);
}