function LanguageNegotiationTestBase::createLanguageNegotiationPlugin

Same name in other branches
  1. 10 core/modules/language/tests/src/Unit/Plugin/LanguageNegotiation/LanguageNegotiationTestBase.php \Drupal\Tests\language\Unit\Plugin\LanguageNegotiation\LanguageNegotiationTestBase::createLanguageNegotiationPlugin()

Creates a @LanguageNegotiation plugin using the factory ::create method.

Return value

\Drupal\language\LanguageNegotiationMethodInterface

2 calls to LanguageNegotiationTestBase::createLanguageNegotiationPlugin()
LanguageNegotiationContentEntityTest::testGetLangcode in core/modules/language/tests/src/Unit/Plugin/LanguageNegotiation/LanguageNegotiationContentEntityTest.php
@covers ::getLangcode
LanguageNegotiationContentEntityTest::testGetLanguageSwitchLinks in core/modules/language/tests/src/Unit/Plugin/LanguageNegotiation/LanguageNegotiationContentEntityTest.php
@covers ::getLanguageSwitchLinks

File

core/modules/language/tests/src/Unit/Plugin/LanguageNegotiation/LanguageNegotiationTestBase.php, line 30

Class

LanguageNegotiationTestBase
Base class used for testing the various LanguageNegotiation plugins.

Namespace

Drupal\Tests\language\Unit\Plugin\LanguageNegotiation

Code

protected function createLanguageNegotiationPlugin(array $configuration = [], $plugin_definition = NULL) {
    $class = $this->getPluginClass();
    $this->assertTrue(in_array(ContainerFactoryPluginInterface::class, class_implements($class)));
    return $class::create(\Drupal::getContainer(), $configuration, $class::METHOD_ID, $plugin_definition);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.