public function HttpTest::testFetchHttp500Error in Migrate Plus 8.5
Same name and namespace in other branches
- 8.4 tests/src/Unit/data_fetcher/HttpTest.php \Drupal\Tests\migrate_plus\Unit\data_fetcher\HttpTest::testFetchHttp500Error()
Test 'http' data fetcher (with auth) dies as expected when server down.
File
- tests/
src/ Unit/ data_fetcher/ HttpTest.php, line 162 - 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 testFetchHttp500Error() : void {
$migration_config = $this->migrationConfiguration + $this->specificMigrationConfig;
$plugin = new TestHttp($migration_config, $this->dataFetcherPluginId, $this->pluginDefinition);
$plugin
->mockHttpClient([
[
500,
'text/html',
'Internal Server Error',
],
], $this->basicAuthenticator);
$this
->expectException(MigrateException::class);
$this
->expectExceptionMessage('GET http://example.org/http_fetcher_test` resulted in a `500 Internal Server Error');
$plugin
->getResponseContent($migration_config['urls'][0]);
}