You are here

public function NodeRevisionDeleteTest::testGetContentTypeConfig in Node Revision Delete 8

Tests the getContentTypeConfig() method.

@covers ::getContentTypeConfig @dataProvider providerGetContentTypeConfig

Parameters

string $expected: The expected result from calling the function.

array $third_party_settings: The content type third party settings.

string $content_type: Content type machine name.

File

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

Class

NodeRevisionDeleteTest
Tests the NodeRevisionDelete class methods.

Namespace

Drupal\Tests\node_revision_delete\Unit

Code

public function testGetContentTypeConfig($expected, array $third_party_settings, $content_type) {

  // ImmutableConfig mock.
  $config = $this
    ->createMock('Drupal\\Core\\Config\\ImmutableConfig');

  // ImmutableConfig::get mock.
  $config
    ->expects($this
    ->any())
    ->method('get')
    ->with('third_party_settings')
    ->willReturn($third_party_settings);

  // Mocking getEditable method.
  $this->configFactory
    ->expects($this
    ->any())
    ->method('get')
    ->with('node.type.' . $content_type)
    ->willReturn($config);

  // Asserting the values.
  $this
    ->assertEquals($expected, $this->nodeRevisionDelete
    ->getContentTypeConfig($content_type));
}