public function HttpTest::testFetchHttpAuthFailure 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::testFetchHttpAuthFailure()
Test 'http' data fetcher (with auth) dies as expected when auth fails.
File
- tests/
src/ Unit/ data_fetcher/ HttpTest.php, line 148 - 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 testFetchHttpAuthFailure() {
$migration_config = $this->migrationConfiguration + $this->specificMigrationConfig;
$plugin = new TestHttp($migration_config, $this->dataFetcherPluginId, $this->pluginDefinition);
$plugin
->mockHttpClient([
[
403,
'text/html',
'Forbidden',
],
], $this->basicAuthenticator);
$this
->setExpectedException(MigrateException::class, 'Error message: Client error: `GET http://example.org/http_fetcher_test` resulted in a `403 Forbidden');
$plugin
->getResponseContent($migration_config['urls'][0]);
}