QueuerConfigFormTest.php in URLs queuer 8
File
tests/src/Functional/QueuerConfigFormTest.php
View source
<?php
namespace Drupal\Tests\purge_queuer_url\Functional;
use Drupal\purge_queuer_url\Form\ConfigurationForm;
use Drupal\Tests\purge_ui\Functional\Form\Config\QueuerConfigFormTestBase;
class QueuerConfigFormTest extends QueuerConfigFormTestBase {
public static $modules = [
'purge_queuer_url',
];
protected $pluginId = 'urlpath';
protected $formClass = ConfigurationForm::class;
protected $formId = 'purge_queuer_url.configuration_form';
public function testSaveConfigurationSubmit() : void {
$this
->drupalLogin($this->adminUser);
$this
->drupalGet($this
->getPath());
$this
->assertSession()
->fieldExists('edit-queue-paths');
$this
->assertSession()
->checkboxNotChecked('edit-queue-paths');
$this
->assertSession()
->fieldExists('edit-host-override');
$this
->assertSession()
->checkboxNotChecked('edit-host-override');
$this
->assertSession()
->fieldExists('edit-host');
$this
->assertSession()
->fieldValueEquals('edit-host', '');
$this
->assertSession()
->fieldExists('edit-scheme-override');
$this
->assertSession()
->checkboxNotChecked('edit-scheme-override');
$this
->assertSession()
->fieldExists('edit-scheme');
$this
->assertSession()
->fieldValueEquals('edit-scheme', 'http');
$this
->assertRaw('Clear traffic history');
$this
->config('purge_queuer_url.settings')
->set('queue_paths', TRUE)
->set('host_override', TRUE)
->set('host', 'foobar.baz')
->set('scheme_override', TRUE)
->set('scheme', 'https')
->save();
$this
->drupalGet($this
->getPath());
$this
->assertSession()
->checkboxChecked('edit-queue-paths');
$this
->assertSession()
->checkboxChecked('edit-host-override');
$this
->assertSession()
->fieldValueEquals('edit-host', 'foobar.baz');
$this
->assertSession()
->checkboxChecked('edit-scheme-override');
$this
->assertSession()
->fieldValueEquals('edit-scheme', 'https');
}
}