/** * Assert Flush Static Files Cache button visibility. * * @param AdminCache $adminCache * @return void */ public function processAssert(AdminCache $adminCache) { if ($_ENV['mage_mode'] === 'production') { \PHPUnit_Framework_Assert::assertFalse($adminCache->getAdditionalBlock()->isFlushCacheButtonVisible(self::FLUSH_STATIC_FILES_CACHE), self::FLUSH_STATIC_FILES_CACHE . ' button should not be visible in production mode.'); } else { \PHPUnit_Framework_Assert::assertTrue($adminCache->getAdditionalBlock()->isFlushCacheButtonVisible(self::FLUSH_STATIC_FILES_CACHE), self::FLUSH_STATIC_FILES_CACHE . ' button should be visible in developer or default mode.'); } }
/** * Open admin cache management page and click button to flush cache. * * @param AdminCache $adminCache * @param string $flushButtonName * @return void */ public function test(AdminCache $adminCache, $flushButtonName) { /** * Skip test for 'Flush Static Files Cache' in production mode. */ if ($flushButtonName === 'Flush Static Files Cache' && $_ENV['mage_mode'] === 'production') { $this->markTestSkipped('Skip flushing static files cache test when in production mode.'); } $adminCache->open(); $adminCache->getAdditionalBlock()->clickFlushCache($flushButtonName); }