SettingsFormTest.php in Stage File Proxy 8
File
tests/src/Functional/SettingsFormTest.php
View source
<?php
namespace Drupal\Tests\stage_file_proxy\Functional;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
class SettingsFormTest extends BrowserTestBase {
public static $modules = [
'stage_file_proxy',
];
protected $adminUser;
protected function setUp() {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser([
'administer stage_file_proxy settings',
]);
}
public function testOriginTrailingslashIsRemoved() {
$settings_path = Url::fromRoute('stage_file_proxy.admin_form');
$this
->drupalLogin($this->adminUser);
$testOrigin = 'http://example.com';
$edit = [
'origin' => $testOrigin . '/',
];
$this
->drupalPostForm($settings_path, $edit, 'Save configuration');
$this
->assertText('Your settings have been saved.');
$newOrigin = $this
->config('stage_file_proxy.settings')
->get('origin');
$this
->assertIdentical($newOrigin, $testOrigin);
}
}