You are here

protected function QueryStringWebformSourceEntityTest::getMockWebform in Webform 8.5

Same name and namespace in other branches
  1. 6.x tests/src/Unit/Plugin/WebformSourceEntity/QueryStringWebformSourceEntityTest.php \Drupal\Tests\webform\Unit\Plugin\WebformSourceEntity\QueryStringWebformSourceEntityTest::getMockWebform()

Get mock webform entity.

Parameters

array $options: Mock webform options.

Return value

\PHPUnit\Framework\MockObject\MockObject A mocked webform entity.

1 call to QueryStringWebformSourceEntityTest::getMockWebform()
QueryStringWebformSourceEntityTest::testGetCurrentSourceEntity in tests/src/Unit/Plugin/WebformSourceEntity/QueryStringWebformSourceEntityTest.php
Tests detection of source entity via query string.

File

tests/src/Unit/Plugin/WebformSourceEntity/QueryStringWebformSourceEntityTest.php, line 154

Class

QueryStringWebformSourceEntityTest
Tests the "query_string" webform source entity plugin.

Namespace

Drupal\Tests\webform\Unit\Plugin\WebformSourceEntity

Code

protected function getMockWebform(array $options) {
  $webform = $this
    ->getMockBuilder(WebformInterface::class)
    ->disableOriginalConstructor()
    ->getMock();
  $webform
    ->method('getSetting')
    ->willReturnMap([
    [
      'form_prepopulate_source_entity',
      FALSE,
      $options['webform_settings_prepopulate_source_entity'],
    ],
  ]);
  $webform
    ->method('id')
    ->willReturn('webform_id');
  return $webform;
}