public function CloudFlareAdminSettingsInvalidFormTest::testInvalidCredentials in CloudFlare 8
Test posting an invalid host to the form.
File
- tests/
src/ Functional/ CloudFlareAdminSettingsInvalidFormTest.php, line 73
Class
- CloudFlareAdminSettingsInvalidFormTest
- Tests \Drupal\purge_ui\Form\CloudFlareAdminSettingsForm.
Namespace
Drupal\Tests\cloudflare\FunctionalCode
public function testInvalidCredentials() {
$mock = new MockHandler([
new Response(403, [], "This could be a problem."),
]);
$container = \Drupal::getContainer();
$config_factory = $container
->get('config.factory');
$logger_channel_cloudflare = $container
->get('logger.channel.cloudflare');
$cloudflare_state = $container
->get('cloudflare.state');
$composer_dependencies_check = $container
->get('cloudflare.composer_dependency_check');
$zone_mock = new ZoneMock($config_factory, $logger_channel_cloudflare, $cloudflare_state, $composer_dependencies_check);
ZoneMock::mockAssertValidCredentials(FALSE);
$container
->set('cloudflare.zone', $zone_mock);
$this
->drupalLogin($this->adminUser);
$edit = [
'apikey' => '68ow48650j63zfzx1w9jd29cr367u0ezb6a4g',
'email' => 'test@test.com',
];
$this
->drupalPostForm($this->route, $edit, t('Next'));
$this
->assertSession()
->addressEquals('/admin/config/services/cloudflare');
}