Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCacheInvalidateNotice.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\PageCache\Test\Page\Adminhtml\AdminCache;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
15 class AssertCacheInvalidateNotice extends AbstractConstraint
16 {
22  private $cacheTypes = [
23  'block_html' => "Blocks HTML output",
24  ];
25 
33  public function processAssert(AdminCache $adminCache, array $caches)
34  {
35  $adminCache->getSystemMessageDialog()->closePopup();
36  foreach ($caches as $cacheType => $cacheStatus) {
37  if ($cacheStatus === 'Invalidated') {
38  \PHPUnit\Framework\Assert::assertContains(
39  $this->cacheTypes[$cacheType],
40  $adminCache->getSystemMessageBlock()->getContent()
41  );
42  } else {
43  \PHPUnit\Framework\Assert::assertNotContains(
44  $this->cacheTypes[$cacheType],
45  $adminCache->getSystemMessageBlock()->getContent()
46  );
47  }
48  }
49  }
50 
56  public function toString()
57  {
58  return 'Cache invalidate notice is correct.';
59  }
60 }