Skip to content
Snippets Groups Projects
Select Git revision
  • 8750f077fca6b5779e0acd8135f2617025e62a07
  • 8.x-1.x default
  • 8.1.1
3 results

PathautoUiTest.php

Blame
  • 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.');*/