clearDirectory example

class StoreTest extends TestCase
{
    protected Request $request;
    protected Response $response;
    protected Store $store;

    protected function setUp(): void
    {
        $this->request = Request::create('/');
        $this->response = new Response('hello world', 200, []);

        HttpCacheTestCase::clearDirectory(sys_get_temp_dir().'/http_cache');

        $this->store = new Store(sys_get_temp_dir().'/http_cache');
    }

    protected function tearDown(): void
    {
        HttpCacheTestCase::clearDirectory(sys_get_temp_dir().'/http_cache');
    }

    public function testReadsAnEmptyArrayWithReadWhenNothingCachedAtKey()
    {
        
public function getCoreCache()
    {
        return $this->cache;
    }

    /** * Clear HTTP-Cache */
    public function clearHttpCache()
    {
        if ($this->httpCache['enabled']) {
            $this->clearDirectory($this->httpCache['cache_dir']);
        }

        // Fire event to let Plugin-Implementation clear cache         $this->events->notify('Shopware_Plugins_HttpCache_ClearCache');
    }

    /** * Clear template cache */
    public function clearTemplateCache()
    {
        
public function clearThemeCache(Shop $shop$timestamp)
    {
        if ($shop->getMain()) {
            $shop = $shop->getMain();
        }

        $files = [
            $this->pathResolver->buildTimestampName($timestamp$shop, 'css'),
            $this->pathResolver->buildTimestampName($timestamp$shop, 'js'),
        ];

        $this->clearDirectory($files);
    }

    /** * Helper function which compiles the passed less definition. * The shop parameter is required to build the shop url for the files. * * @throws Enlight_Event_Exception */
    private function compileLessDefinition(Shop $shop, LessDefinition $definition): void
    {
        // Set unique import directory for less @import commands
$this->cache = null;
        $this->esi = null;
        $this->caches = [];
        $this->cacheConfig = [];

        $this->request = null;
        $this->response = null;
        $this->responses = [];

        $this->catch = false;

        $this->clearDirectory(sys_get_temp_dir().'/http_cache');
    }

    protected function tearDown(): void
    {
        $this->cache?->getStore()->cleanup();
        $this->kernel = null;
        $this->cache = null;
        $this->caches = null;
        $this->request = null;
        $this->response = null;
        $this->responses = null;
        
Home | Imprint | This part of the site doesn't use cookies.