Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertFlushStaticFilesCacheButtonVisibility.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 AssertFlushStaticFilesCacheButtonVisibility extends AbstractConstraint
16 {
17  const FLUSH_STATIC_FILES_CACHE = 'Flush Static Files Cache';
18 
25  public function processAssert(AdminCache $adminCache)
26  {
27  if ($_ENV['mage_mode'] === 'production') {
28  \PHPUnit\Framework\Assert::assertFalse(
29  $adminCache->getAdditionalBlock()->isFlushCacheButtonVisible(self::FLUSH_STATIC_FILES_CACHE),
30  self::FLUSH_STATIC_FILES_CACHE . ' button should not be visible in production mode.'
31  );
32  } else {
33  \PHPUnit\Framework\Assert::assertTrue(
34  $adminCache->getAdditionalBlock()->isFlushCacheButtonVisible(self::FLUSH_STATIC_FILES_CACHE),
35  self::FLUSH_STATIC_FILES_CACHE . ' button should be visible in developer or default mode.'
36  );
37  }
38  }
39 
45  public function toString()
46  {
47  return self::FLUSH_STATIC_FILES_CACHE . ' button has correct visibility.';
48  }
49 }