Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCacheStatus.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 AssertCacheStatus extends AbstractConstraint
16 {
22  private $cacheTypes = [
23  'block_html' => "Blocks HTML output",
24  'full_page' => "Page Cache",
25  ];
26 
34  public function processAssert(AdminCache $adminCache, array $caches)
35  {
36  $adminCache->open();
37  foreach ($caches as $cacheType => $cacheStatus) {
38  \PHPUnit\Framework\Assert::assertTrue(
39  $adminCache->getGridBlock()->isCacheStatusCorrect($this->cacheTypes[$cacheType], $cacheStatus),
40  $this->cacheTypes[$cacheType] . " cache status in grid does not equal to " . $cacheStatus
41  );
42  }
43  }
44 
50  public function toString()
51  {
52  return 'Cache status is correct.';
53  }
54 }
processAssert(AdminCache $adminCache, array $caches)