protected function GoogleSearchTest::setUp in Freelinking 8.3
Same name and namespace in other branches
- 4.0.x tests/src/Unit/Plugin/freelinking/GoogleSearchTest.php \Drupal\Tests\freelinking\Unit\Plugin\freelinking\GoogleSearchTest::setUp()
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ Plugin/ freelinking/ GoogleSearchTest.php, line 36
Class
- GoogleSearchTest
- Tests the google search plugin.
Namespace
Drupal\Tests\freelinking\Unit\Plugin\freelinkingCode
protected function setUp() {
// Mock the string translation.
$tProphet = $this
->prophesize('\\Drupal\\Core\\StringTranslation\\TranslationInterface');
$tProphet
->translateString(Argument::any())
->willReturn('Search google for the specified terms.');
$this->translationInterfaceMock = $tProphet
->reveal();
// Mock path validator.
$pathValidatorProphet = $this
->prophesize('\\Drupal\\Core\\Path\\PathValidatorInterface');
$container = new ContainerBuilder();
$container
->set('string_translation', $this->translationInterfaceMock);
$container
->set('path.validator', $pathValidatorProphet
->reveal());
\Drupal::setContainer($container);
$plugin_definition = [
'id' => 'google',
'title' => 'Google Search',
'hidden' => FALSE,
'weight' => 1,
];
$this->plugin = new GoogleSearch([], 'google', $plugin_definition);
}