You are here

private function NodeRevisionDeleteTest::getNodeRevisionDeleteMock in Node Revision Delete 8

Mock some NodeRevisionDelete class functions.

Parameters

array $content_types_list: A list with content types objects.

Return value

\Drupal\node_revision_delete\NodeRevisionDelete|\PHPUnit\Framework\MockObject\MockObject The mocked class.

1 call to NodeRevisionDeleteTest::getNodeRevisionDeleteMock()
NodeRevisionDeleteTest::testUpdateTimeMaxNumberConfig in tests/src/Unit/NodeRevisionDeleteTest.php
Tests the updateTimeMaxNumberConfig() method.

File

tests/src/Unit/NodeRevisionDeleteTest.php, line 651

Class

NodeRevisionDeleteTest
Tests the NodeRevisionDelete class methods.

Namespace

Drupal\Tests\node_revision_delete\Unit

Code

private function getNodeRevisionDeleteMock(array $content_types_list) {

  // Mock NodeRevisionDelete.

  /** @var \Drupal\node_revision_delete\NodeRevisionDelete|\PHPUnit_Framework_MockObject_MockObject $controller */
  $controller = $this
    ->getMockBuilder('Drupal\\node_revision_delete\\NodeRevisionDelete')
    ->setConstructorArgs([
    $this->configFactory,
    $this
      ->getStringTranslationStub(),
    $this->connection,
    $this->entityTypeManager,
    $this->languageManager,
  ])
    ->setMethods([
    'getConfiguredContentTypes',
  ])
    ->getMock();

  // Mock getContentTypesList().
  $controller
    ->expects($this
    ->any())
    ->method('getConfiguredContentTypes')
    ->willReturn($content_types_list);
  return $controller;
}