![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Backend\Controller\Adminhtml; /** * @magentoAppArea adminhtml */ class CacheTest extends \Magento\TestFramework\TestCase\AbstractBackendController { /** * @magentoDataFixture Magento/Backend/controllers/_files/cache/application_cache.php * @magentoDataFixture Magento/Backend/controllers/_files/cache/non_application_cache.php */ public function testFlushAllAction() { /** @var $cache \Magento\Framework\App\Cache */ $cache = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Framework\App\Cache::class ); $this->assertNotEmpty($cache->load('APPLICATION_FIXTURE')); $this->dispatch('backend/admin/cache/flushAll'); /** @var $cachePool \Magento\Framework\App\Cache\Frontend\Pool */ $this->assertFalse($cache->load('APPLICATION_FIXTURE')); $cachePool = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Framework\App\Cache\Frontend\Pool::class ); /** @var $cacheFrontend \Magento\Framework\Cache\FrontendInterface */ foreach ($cachePool as $cacheFrontend) { $this->assertFalse($cacheFrontend->getBackend()->load('NON_APPLICATION_FIXTURE')); } } /** * @magentoDataFixture Magento/Backend/controllers/_files/cache/application_cache.php * @magentoDataFixture Magento/Backend/controllers/_files/cache/non_application_cache.php */ public function testFlushSystemAction() { $this->dispatch('backend/admin/cache/flushSystem'); /** @var $cache \Magento\Framework\App\Cache */ $cache = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Framework\App\Cache::class ); /** @var $cachePool \Magento\Framework\App\Cache\Frontend\Pool */ $this->assertFalse($cache->load('APPLICATION_FIXTURE')); $cachePool = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Framework\App\Cache\Frontend\Pool::class ); /** @var $cacheFrontend \Magento\Framework\Cache\FrontendInterface */ foreach ($cachePool as $cacheFrontend) { $this->assertSame( 'non-application cache data', $cacheFrontend->getBackend()->load('NON_APPLICATION_FIXTURE') ); } } /** * @dataProvider massActionsInvalidTypesDataProvider * @param $action */ public function testMassActionsInvalidTypes($action) { $this->getRequest()->setParams(['types' => ['invalid_type_1', 'invalid_type_2', 'config']]); $this->dispatch('backend/admin/cache/' . $action); $this->assertSessionMessages( $this->containsEqual("These cache type(s) don't exist: invalid_type_1, invalid_type_2"), \Magento\Framework\Message\MessageInterface::TYPE_ERROR ); } /** * @return array */ public function massActionsInvalidTypesDataProvider() { return [ 'enable' => ['massEnable'], 'disable' => ['massDisable'], 'refresh' => ['massRefresh'] ]; } }