HttpTest.php in Migrate Plus 8.4
File
tests/src/Kernel/Plugin/migrate_plus/data_fetcher/HttpTest.php
View source
<?php
namespace Drupal\Tests\migrate_plus\Kernel\Plugin\migrate_plus\data_fetcher;
use Drupal\KernelTests\KernelTestBase;
use Drupal\migrate_plus\Plugin\migrate_plus\data_fetcher\Http;
class HttpTest extends KernelTestBase {
public function testHttpHeaders(array $definition, array $expected, array $preSeed = []) {
$http = new Http($definition, 'http', []);
$this
->assertEquals($expected, $http
->getRequestHeaders());
}
public function headerDataProvider() {
return [
'dummy headers specified' => [
'definition' => [
'headers' => [
'Accept' => 'application/json',
'User-Agent' => 'Internet Explorer 6',
'Authorization-Key' => 'secret',
'Arbitrary-Header' => 'foobarbaz',
],
],
'expected' => [
'Accept' => 'application/json',
'User-Agent' => 'Internet Explorer 6',
'Authorization-Key' => 'secret',
'Arbitrary-Header' => 'foobarbaz',
],
],
'no headers specified' => [
'definition' => [
'no_headers_here' => 'foo',
],
'expected' => [],
],
];
}
}