$this->
assertEquals( $this->
getUrl(),
Url::
fromRoute('search.view_' .
$entity_id,
[],
['query' =>
['keys' => ''
], 'absolute' => TRUE
])->
toString(),
'Redirected to correct URL.'
);
// Test that after entering a too-short keyword in the form, you can then
// search again with a longer keyword. First test using the block form.
$this->
drupalGet('node'
);
$this->
submitForm(['keys' =>
$this->
randomMachineName(1
)], 'Search'
);
$this->
assertSession()->
statusMessageContains('You must include at least one keyword to match in the content', 'warning'
);
$this->
assertSession()->
statusMessageNotContains('Please enter some keywords'
);
$this->
submitForm(['keys' =>
$this->
randomMachineName()], 'Search', 'search-block-form'
);
$this->
assertSession()->
statusMessageNotContains('You must include at least one keyword to match in the content'
);
// Same test again, using the search page form for the second search this
// time.
$this->
drupalGet('node'
);
$this->
submitForm(['keys' =>
$this->
randomMachineName(1
)], 'Search'
);
$this->
submitForm(['keys' =>
$this->
randomMachineName()], 'Search', 'search-form'
);
$this->
assertSession()->
statusMessageNotContains('You must include at least one keyword to match in the content'
);
// Edit the block configuration so that it searches users instead of nodes,