You are here

public function OnlyOneTest::testAddAditionalInfoToContentTypesIsolated in Allow a content type only once (Only One) 8

Tests the OnlyOne::addAditionalInfoToContentTypes() method in isolation.

@covers ::addAditionalInfoToContentTypes @dataProvider providerGetAvailableContentTypesSummarized

Parameters

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

array $configured: The configured content types to have onlyone node.

array $content_types: The returned content types from the the database query.

bool $multilingual: Whether the site is multilingual or not.

Throws

\ReflectionException

File

tests/src/Unit/OnlyOneTest.php, line 770

Class

OnlyOneTest
Tests the OnlyOne class methods.

Namespace

Drupal\Tests\onlyone\Unit

Code

public function testAddAditionalInfoToContentTypesIsolated(array $expected, array $configured, array $content_types, $multilingual) {

  // Mock OnlyOne.
  $controller = $this
    ->getOnlyOneMock($configured, $multilingual);

  // Making accesible the getTemporaryContentTypesTableName method.
  $method = new \ReflectionMethod($controller, 'addAditionalInfoToContentTypes');
  $method
    ->setAccessible(TRUE);

  // Invoking the function.
  $method
    ->invokeArgs($controller, [
    &$content_types,
  ]);

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