KeyInputTest.php in Key 8
File
tests/src/Functional/KeyInputTest.php
View source
<?php
namespace Drupal\Tests\key\Functional;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Tests\BrowserTestBase;
use Drupal\Core\Url;
class KeyInputTest extends BrowserTestBase {
use KeyTestTrait;
protected static $modules = [
'key',
];
protected $adminUser;
protected $defaultTheme = 'stark';
protected function setUp() {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser([
'administer keys',
]);
}
public function testLongKey() {
$this
->drupalLogin($this->adminUser);
$assert_session = $this
->assertSession();
$this
->drupalGet('admin/config/system/keys/add');
$edit = [
'id' => 'testing_key',
'label' => 'Testing Key',
'key_type' => 'authentication',
'key_input_settings[key_value]' => str_pad('', 4000, 'z'),
];
$this
->drupalPostForm(NULL, $edit, 'Save');
$this
->assertSession()
->pageTextContains(sprintf('The key %s has been added.', $edit['label']));
$this
->drupalGet('admin/config/system/keys/manage/testing_key');
$assert_session
->statusCodeEquals(200);
}
}