Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertUrlRewriteCustomRedirect.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Cms\Test\Page\CmsIndex;
11 use Magento\Mtf\Client\BrowserInterface;
12 use Magento\Mtf\Constraint\AbstractConstraint;
13 
18 class AssertUrlRewriteCustomRedirect extends AbstractConstraint
19 {
28  public function processAssert(UrlRewrite $urlRewrite, BrowserInterface $browser, CmsIndex $cmsIndex)
29  {
30  $browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath());
31  $entity = $urlRewrite->getDataFieldConfig('target_path')['source']->getEntity();
32  $title = $entity->hasData('name') ? $entity->getName() : $entity->getContentHeading();
33  $pageTitle = $cmsIndex->getTitleBlock()->getTitle();
34  \PHPUnit\Framework\Assert::assertEquals(
35  $pageTitle,
36  $title,
37  'URL rewrite product redirect false.'
38  . "\nExpected: " . $title
39  . "\nActual: " . $pageTitle
40  );
41  }
42 
48  public function toString()
49  {
50  return 'Custom URL rewrite redirect was success.';
51  }
52 }
$title
Definition: default.phtml:14
processAssert(UrlRewrite $urlRewrite, BrowserInterface $browser, CmsIndex $cmsIndex)
$entity
Definition: element.phtml:22