function OEmbedTestTrait::lockHttpClientToFixtures
Same name in other branches
- 8.9.x core/modules/media/tests/src/Traits/OEmbedTestTrait.php \Drupal\Tests\media\Traits\OEmbedTestTrait::lockHttpClientToFixtures()
- 10 core/modules/media/tests/src/Traits/OEmbedTestTrait.php \Drupal\Tests\media\Traits\OEmbedTestTrait::lockHttpClientToFixtures()
- 11.x core/modules/media/tests/src/Traits/OEmbedTestTrait.php \Drupal\Tests\media\Traits\OEmbedTestTrait::lockHttpClientToFixtures()
Configures the HTTP client to always use the fixtures directory.
All requests are carried out relative to the URL of the fixtures directory. For example, after calling this method, a request for foobar.html will actually request http://test-site/path/to/fixtures/foobar.html.
6 calls to OEmbedTestTrait::lockHttpClientToFixtures()
- MediaSourceOEmbedVideoTest::setUp in core/
modules/ media/ tests/ src/ FunctionalJavascript/ MediaSourceOEmbedVideoTest.php - MediaStandardProfileTest::setUp in core/
modules/ media/ tests/ src/ FunctionalJavascript/ MediaStandardProfileTest.php - OEmbedFormatterTest::setUp in core/
modules/ media/ tests/ src/ Functional/ FieldFormatter/ OEmbedFormatterTest.php - ResourceFetcherTest::setUp in core/
modules/ media/ tests/ src/ Functional/ ResourceFetcherTest.php - UrlResolverTest::setUp in core/
modules/ media/ tests/ src/ Functional/ UrlResolverTest.php
File
-
core/
modules/ media/ tests/ src/ Traits/ OEmbedTestTrait.php, line 48
Class
- OEmbedTestTrait
- Contains helper functions for testing oEmbed functionality in isolation.
Namespace
Drupal\Tests\media\TraitsCode
protected function lockHttpClientToFixtures() {
$this->writeSettings([
'settings' => [
'http_client_config' => [
'base_uri' => (object) [
'value' => $this->getFixturesUrl() . '/',
'required' => TRUE,
],
],
],
]);
// Rebuild the container in case there is already an instantiated service
// that has a dependency on the http_client service.
$this->container
->get('kernel')
->rebuildContainer();
$this->container = $this->container
->get('kernel')
->getContainer();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.