Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductAutoincrementedSkuNoticeMessage.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 use Magento\Mtf\Fixture\FixtureInterface;
12 
16 class AssertProductAutoincrementedSkuNoticeMessage extends AbstractConstraint
17 {
25  public function processAssert(CatalogProductEdit $productPage, FixtureInterface $product)
26  {
27  $actualMessage = $productPage->getMessagesBlock()->getNoticeMessage();
28  $reg = '/(SKU for product ' . $product->getName() . ' has been changed to ' . $product->getSku() . '-)(\d+.$)/';
29  \PHPUnit\Framework\Assert::assertTrue(
30  preg_match($reg, $actualMessage) == 1,
31  'Incorrect notice that existing sku automatically changed when saving product with same sku.'
32  );
33  }
34 
40  public function toString()
41  {
42  return 'Notice that existing sku automatically changed when saving product with same sku is correct.';
43  }
44 }