Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertSitemapFailPathSaveMessage.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Sitemap\Test\Fixture\Sitemap;
10 use Magento\Sitemap\Test\Page\Adminhtml\SitemapIndex;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 
16 class AssertSitemapFailPathSaveMessage extends AbstractConstraint
17 {
18  const FAIL_PATH_MESSAGE = 'Path "/%s" is not available and cannot be used.';
19 
27  public function processAssert(SitemapIndex $sitemapPage, Sitemap $sitemap)
28  {
29  $actualMessage = $sitemapPage->getMessagesBlock()->getErrorMessage();
30  \PHPUnit\Framework\Assert::assertEquals(
31  sprintf(self::FAIL_PATH_MESSAGE, $sitemap->getSitemapFilename()),
32  $actualMessage,
33  'Wrong error message is displayed.'
34  . "\nExpected: " . self::FAIL_PATH_MESSAGE
35  . "\nActual: " . $actualMessage
36  );
37  }
38 
44  public function toString()
45  {
46  return 'Error message after creating sitemap with wrong path is present.';
47  }
48 }