Commit 068bb1a0 authored by webchick's avatar webchick

Issue #2353347 follow-up by dawehner, alexpott: Fixed Random failure in DisplayPathTest.

parent 2730f9b2
......@@ -15,6 +15,7 @@
use Drupal\Core\State\StateInterface;
use Drupal\Core\Routing\RouteCompiler;
use Drupal\Core\Routing\RouteProviderInterface;
use Drupal\Core\Url;
use Drupal\views\Views;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -460,6 +461,10 @@ protected function validatePath($path) {
$errors[] = $this->t('No query allowed.');
}
if (!parse_url('base://' . $path)) {
$errors[] = $this->t('Invalid path. Valid characters are alphanumerics as well as "-", ".", "_" and "~".');
}
$path_sections = explode('/', $path);
// Symfony routing does not allow to use numeric placeholders.
// @see \Symfony\Component\Routing\RouteCompiler
......
......@@ -105,8 +105,12 @@ public function testMenuOptions() {
$this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', array('path' => '?bar'), t('Apply'));
$this->assertText('Path is empty');
// Add an invalid path from a random test failure.
$this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', array('path' => 'AKI@&hO@'), t('Apply'));
$this->assertText('Invalid path');
// Provide a random, valid path string.
$random_string = str_replace(['?', '#'], '_', $this->randomString());
$random_string = $this->randomMachineName();
// Save a path.
$this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', array('path' => $random_string), t('Apply'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment