Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertSearchTermNotOnFrontend.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Cms\Test\Page\CmsIndex;
11 use Magento\Mtf\Client\BrowserInterface;
12 use Magento\Mtf\Constraint\AbstractConstraint;
13 
18 class AssertSearchTermNotOnFrontend extends AbstractConstraint
19 {
28  public function processAssert(CmsIndex $cmsIndex, BrowserInterface $browser, CatalogSearchQuery $searchTerm)
29  {
30  $queryText = $searchTerm->getQueryText();
31  $cmsIndex->open()->getSearchBlock()->search($queryText);
32  \PHPUnit\Framework\Assert::assertNotEquals(
33  $browser->getUrl(),
34  $searchTerm->getRedirect(),
35  'Url in the browser corresponds to Url in fixture (redirect has been performed).'
36  . PHP_EOL . 'Search term: "' . $queryText . '"'
37  );
38  }
39 
45  public function toString()
46  {
47  return 'Search term was successfully removed (redirects to the specified URL was not performed).';
48  }
49 }
processAssert(CmsIndex $cmsIndex, BrowserInterface $browser, CatalogSearchQuery $searchTerm)