public function CloudFlareAdminSettingsFormTest::testInvalidBypassHostWithHttps in CloudFlare 8
Test posting an invalid host with https protocol to the form.
File
- tests/
src/ Functional/ CloudFlareAdminSettingsFormTest.php, line 83
Class
- CloudFlareAdminSettingsFormTest
- Tests \Drupal\purge_ui\Form\CloudFlareAdminSettingsForm.
Namespace
Drupal\Tests\cloudflare\FunctionalCode
public function testInvalidBypassHostWithHttps() {
$edit = [
'apikey' => '68ow48650j63zfzx1w9jd29cr367u0ezb6a4g',
'email' => 'test@test.com',
'client_ip_restore_enabled' => TRUE,
'bypass_host' => 'https://blah.com',
];
ZoneMock::mockAssertValidCredentials(TRUE);
$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);
$container
->set('cloudflare.zone', $zone_mock);
$this
->drupalPostForm($this->route, $edit, t('Next'));
$this
->assertSession()
->pageTextContains('Please enter a host without http/https');
}