Spamworldpro Mini Shell
Spamworldpro


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/Framework/App/Cache/Frontend/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/dev/tests/integration/testsuite/Magento/Framework/App/Cache/Frontend/PoolTest.php
<?php declare(strict_types=1);

/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Magento\Framework\App\Cache\Frontend;

use Magento\Framework\ObjectManager\ConfigInterface as ObjectManagerConfig;
use Magento\TestFramework\ObjectManager;
use PHPUnit\Framework\TestCase;

/**
 * This superfluous comment can be removed as soon as the sniffs have been updated to match the coding guide lines.
 */
class PoolTest extends TestCase
{
    public function testPageCacheNotSameAsDefaultCacheDirectory(): void
    {
        /** @var ObjectManagerConfig $diConfig */
        $diConfig = ObjectManager::getInstance()->get(ObjectManagerConfig::class);
        $argumentConfig = $diConfig->getArguments(\Magento\Framework\App\Cache\Frontend\Pool::class);

        $pageCacheDir = $argumentConfig['frontendSettings']['page_cache']['backend_options']['cache_dir'] ?? null;
        $defaultCacheDir = $argumentConfig['frontendSettings']['default']['backend_options']['cache_dir'] ?? null;

        $noPageCacheMessage = "No default page_cache directory set in di.xml: \n" . var_export($argumentConfig, true);
        $this->assertNotEmpty($pageCacheDir, $noPageCacheMessage);

        $sameCacheDirMessage = 'The page_cache and default cache storages share the same cache directory';
        $this->assertNotSame($pageCacheDir, $defaultCacheDir, $sameCacheDirMessage);
    }

    /**
     * @covers  \Magento\Framework\App\Cache\Frontend\Pool::_getCacheSettings
     * @depends testPageCacheNotSameAsDefaultCacheDirectory
     */
    public function testCleaningDefaultCachePreservesPageCache()
    {
        $testData = 'test data';
        $testKey = 'test-key';

        /** @var \Magento\Framework\App\Cache\Frontend\Pool $cacheFrontendPool */
        $cacheFrontendPool = ObjectManager::getInstance()->get(\Magento\Framework\App\Cache\Frontend\Pool::class);

        $pageCache = $cacheFrontendPool->get('page_cache');
        $pageCache->save($testData, $testKey);

        $defaultCache = $cacheFrontendPool->get('default');
        $defaultCache->clean();

        $this->assertSame($testData, $pageCache->load($testKey));
    }
}

Spamworldpro Mini