You are here

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

Tests the OnlyOne::getTemporaryContentTypesTableName() method.

@covers ::getTemporaryContentTypesTableName @dataProvider providerGetTemporaryContentTypesTableName

Parameters

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

Throws

\ReflectionException

File

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

Class

OnlyOneTest
Tests the OnlyOne class methods.

Namespace

Drupal\Tests\onlyone\Unit

Code

public function testGetTemporaryContentTypesTableName($expected) {

  // Mocking queryTemporary.
  $this->connection
    ->expects($this
    ->any())
    ->method('queryTemporary')
    ->willReturn($expected);

  // Making accessible the getTemporaryContentTypesTableName method.
  $method = new \ReflectionMethod('Drupal\\onlyone\\OnlyOne', 'getTemporaryContentTypesTableName');
  $method
    ->setAccessible(TRUE);

  // Testing the function.
  $this
    ->assertEquals($expected, $method
    ->invoke($this->onlyOne));
}