Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertSitemapFailFolderSaveMessage.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 AssertSitemapFailFolderSaveMessage extends AbstractConstraint
17 {
18  const FAIL_FOLDER_MESSAGE = 'Please create the specified folder "%s" before saving the sitemap.';
19 
27  public function processAssert(SitemapIndex $sitemapPage, Sitemap $sitemap)
28  {
29  $actualMessage = $sitemapPage->getMessagesBlock()->getErrorMessage();
30  \PHPUnit\Framework\Assert::assertEquals(
31  sprintf(self::FAIL_FOLDER_MESSAGE, $sitemap->getSitemapPath()),
32  $actualMessage,
33  'Wrong error message is displayed.'
34  . "\nExpected: " . self::FAIL_FOLDER_MESSAGE
35  . "\nActual: " . $actualMessage
36  );
37  }
38 
44  public function toString()
45  {
46  return 'Error message after creating sitemap with wrong folder is present.';
47  }
48 }