Select Git revision
PathautoUiTest.php
PathautoUiTest.php 3.45 KiB
<?php
/**
* @file
* Contains \Drupal\pathauto\Tests\PathautoUiTest.
*/
namespace Drupal\pathauto\Tests;
use Drupal\simpletest\WebTestBase;
/**
* Test basic pathauto functionality.
*
* @group pathauto
*/
class PathautoUiTest extends WebTestBase {
use PathautoTestHelperTrait;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('pathauto', 'node');
/**
* Admin user.
*
* @var \Drupal\user\UserInterface
*/
protected $adminUser;
/**
* {inheritdoc}
*/
function setUp() {
parent::setUp();
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
$this->drupalCreateContentType(array('type' => 'article'));
// Allow other modules to add additional permissions for the admin user.
$permissions = array(
'administer pathauto',
'administer url aliases',
'create url aliases',
'administer nodes',
'bypass node access',
'access content overview',
);
$this->adminUser = $this->drupalCreateUser($permissions);
$this->drupalLogin($this->adminUser);
}
function testSettingsValidation() {
$edit = array();
$edit['max_length'] = 'abc';
$edit['max_component_length'] = 'abc';
$this->drupalPostForm('admin/config/search/path/settings', $edit, 'Save configuration');
/*$this->assertText('The field Maximum alias length is not a valid number.');
$this->assertText('The field Maximum component length is not a valid number.');*/
$this->assertNoText('The configuration options have been saved.');
$edit['max_length'] = '0';
$edit['max_component_length'] = '0';
$this->drupalPostForm('admin/config/search/path/settings', $edit, 'Save configuration');
/*$this->assertText('The field Maximum alias length cannot be less than 1.');
$this->assertText('The field Maximum component length cannot be less than 1.');*/