You are here

public function FieldsTest::containerGetCallback in Layout Plugin Views 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/FieldsTest.php \Drupal\Tests\layout_plugin_views\Unit\FieldsTest::containerGetCallback()

Callback for the get method of the mocked container. Creates and returns a mock for every relevant service.

Parameters

string $argument:

Return value

\PHPUnit_Framework_MockObject_MockObject

File

tests/src/Unit/FieldsTest.php, line 263

Class

FieldsTest
@coversDefaultClass \Drupal\layout_plugin_views\Plugin\views\row\Fields @group Panels

Namespace

Drupal\Tests\layout_plugin_views\Unit

Code

public function containerGetCallback($argument) {
  switch ($argument) {
    case 'plugin.manager.layout_plugin':
      return $this
        ->createLayoutPluginManagerMock();
    case 'string_translation':
      return $this
        ->getMockBuilder(TranslationManager::class)
        ->disableOriginalConstructor()
        ->setMethods(NULL)
        ->getMock();
    case 'renderer':
      $mock = $this
        ->getMockForAbstractClass(RendererInterface::class);
      $mock
        ->method('executeInRenderContext')
        ->willReturnCallback([
        $this,
        'rendererCallback',
      ]);
      return $mock;
    default:
      return NULL;
  }
}