function thunder_test_mock_request_install in Thunder 6.2.x
Same name and namespace in other branches
- 8.5 tests/modules/thunder_test_mock_request/thunder_test_mock_request.install \thunder_test_mock_request_install()
- 6.1.x tests/modules/thunder_test_mock_request/thunder_test_mock_request.install \thunder_test_mock_request_install()
Implements hook_install().
File
- tests/
modules/ thunder_test_mock_request/ thunder_test_mock_request.install, line 13 - Install functions for thunder_test_mock_request.
Code
function thunder_test_mock_request_install() {
$fixturesDirectory = drupal_get_path('profile', 'thunder') . '/tests/fixtures/oembed';
MockHttpClientMiddleware::addUrlResponse('https://oembed.com/providers.json', file_get_contents($fixturesDirectory . '/providers.json'), [
'Content-Type' => 'application/json',
]);
MockHttpClientMiddleware::addUrlResponse('https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=PWjcqE3QKBg', file_get_contents($fixturesDirectory . '/youtube.json'), [
'Content-Type' => 'application/json',
]);
MockHttpClientMiddleware::addUrlResponse('https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=PWjcqE3QKBg&maxwidth=241&maxheight=138', file_get_contents($fixturesDirectory . '/youtube.json'), [
'Content-Type' => 'application/json',
]);
MockHttpClientMiddleware::addUrlResponse('https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=PWjcqE3QKBg&maxwidth=854&maxheight=480', file_get_contents($fixturesDirectory . '/youtube.json'), [
'Content-Type' => 'application/json',
]);
MockHttpClientMiddleware::addUrlResponse('https://publish.twitter.com/oembed?url=https://twitter.com/ThunderCoreTeam/status/776417570756976640', file_get_contents($fixturesDirectory . '/twitter.json'), [
'Content-Type' => 'application/json',
]);
MockHttpClientMiddleware::addUrlResponse('https://graph.facebook.com/v8.0/instagram_oembed?url=https://www.instagram.com/p/B2huuS8AQVq/&access_token=123%7C123&omitscript=1', file_get_contents($fixturesDirectory . '/instagram.json'), [
'Content-Type' => 'application/json',
]);
}