public function HttpTest::testFetchHttpNoAuth in Migrate Plus 8.4
Same name and namespace in other branches
- 8.5 tests/src/Unit/data_fetcher/HttpTest.php \Drupal\Tests\migrate_plus\Unit\data_fetcher\HttpTest::testFetchHttpNoAuth()
Test 'http' data fetcher (without auth) returns an expected response.
File
- tests/
src/ Unit/ data_fetcher/ HttpTest.php, line 130 - PHPUnit tests for the Migrate Plus Http 'data fetcher' plugin.
Class
- HttpTest
- @coversDefaultClass \Drupal\migrate_plus\Plugin\migrate_plus\data_fetcher\Http
Namespace
Drupal\Tests\migrate_plus\Unit\data_fetcherCode
public function testFetchHttpNoAuth() {
$migration_config = $this->migrationConfiguration + $this->specificMigrationConfig;
unset($migration_config['authentication']);
$plugin = new TestHttp($migration_config, $this->dataFetcherPluginId, $this->pluginDefinition);
$plugin
->mockHttpClient([
[
200,
'application/json',
$this->testData,
],
], NULL);
$stream = $plugin
->getResponseContent($migration_config['urls'][0]);
$body = json_decode((string) $stream, TRUE);
$expected = json_decode($this->testData, TRUE);
$this
->assertArrayEquals($expected, $body);
}