Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCacheIsRefreshableAndInvalidated.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Constraint\AbstractConstraint;
10 use Magento\PageCache\Test\Page\Adminhtml\AdminCache;
11 
15 class AssertCacheIsRefreshableAndInvalidated extends AbstractConstraint
16 {
20  const SUCCESS_MESSAGE = '%d cache type(s) refreshed.';
21 
29  public function processAssert(AdminCache $adminCache, $cacheTags)
30  {
31  $items = [];
32  foreach ($cacheTags as $cacheTag) {
33  $items[] = [
34  'tags' => $cacheTag,
35  'status' => 'Invalidated'
36  ];
37  }
38 
39  $adminCache->open();
40  $adminCache->getGridBlock()->massaction($items, 'Refresh');
41 
42  \PHPUnit\Framework\Assert::assertEquals(
43  sprintf(self::SUCCESS_MESSAGE, count($items)),
44  $adminCache->getMessagesBlock()->getSuccessMessage(),
45  'Cache is Invalid and refreshable.'
46  );
47  }
48 
54  public function toString()
55  {
56  return 'Cache is not Invalid or not refreshable.';
57  }
58 }
$items