function PathRedirectFunctionalTest::testAutocomplete in Path redirect 6
File
- ./
path_redirect.test, line 249 - Tests for the path_redirect module.
Class
Code
function testAutocomplete() {
// Create 404 errors.
$this
->drupalGet('test1');
$this
->drupalGet('test2');
$this
->drupalGet('test2');
$this
->drupalGet('tst3');
// Create a 404 and then create a valid redirect for it.
$this
->drupalGet('test3');
$this
->addRedirect('test3', 'node');
// Create a 404 and then create a valid path for it.
$this
->drupalGet('node/1');
$node = $this
->drupalCreateNode();
$this
->assertEqual($node->nid, 1, t('Node 1 created'));
// Test that only the valid 404s are found in the autocomplete.
$this
->drupalGet('js/path_redirect/autocomplete_404/e');
$this
->assertText('test1');
$this
->assertText('test2');
$this
->assertNoText('node');
$this
->assertNoText('test3');
$this
->assertNoText('tst3');
// Test that the 404 with the greater hits is listed first.
$this
->assertTrue(strpos($this
->drupalGetContent(), 'test1') > strpos($this
->drupalGetContent(), 'test2'), t('Paths ordered correctly.'));
}