You are here

public function HidePreviewTest::__construct in Hide Preview Button 8

Initializes the test class with a mock of the base class.

@inheritdoc

File

src/tests/src/Unit/HidePreviewTest.php, line 24

Class

HidePreviewTest
Tests some functions of the Hide Preview module.

Namespace

Drupal\Tests\phpunit_example\Unit

Code

public function __construct($name = NULL, array $data = [], $dataName = '') {
  parent::__construct($name, $data, $dataName);

  // Gets the available methods.
  $methods = get_class_methods(HidePreviewConfigForm::class);

  // Unsets the methods we want to test.
  unset($methods[array_search('multiline2Array', $methods)]);

  // Gets the mock class.
  $this->configForm = $this
    ->getMockBuilder(HidePreviewConfigForm::class)
    ->disableOriginalConstructor()
    ->setMethods($methods)
    ->getMock();
}