Source of file ProxyCacheFactoryTest.php
Size: 1,643 Bytes - Last Modified: 2021-12-23T10:35:47+00:00
/var/www/docs.ssmods.com/process/src/tests/php/Caching/ProxyCacheFactoryTest.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 | <?php namespace SilverStripe\Versioned\Tests\Caching; use SilverStripe\Dev\SapphireTest; use Symfony\Component\Cache\Adapter\PhpFilesAdapter; use Symfony\Component\Cache\Simple\PhpFilesCache; class ProxyCacheFactoryTest extends SapphireTest { protected function setUp(): void { parent::setUp(); if (!PhpFilesAdapter::isSupported()) { $this->markTestSkipped("This test requires opcache enabled"); } } public function testCreateFallback() { $factory = new ProxyCacheFactoryFake([ 'argOne' => 'one' ]); $result = $factory->create('dummy', ['argTwo' => 'two']); $this->assertTrue($result instanceof PhpFilesCache); } public function testCreateCustomContainer() { $factory = new ProxyCacheFactoryFake([ 'argOne' => 'one', 'container' => ProxyCacheAdapterFake::class, ]); $result = $factory->create('dummy', []); $this->assertTrue($result instanceof ProxyCacheAdapterFake); $factory = new ProxyCacheFactoryFake([ 'argOne' => 'one', ]); $result = $factory->create('dummy', ['container' => ProxyCacheAdapterFake::class]); $this->assertTrue($result instanceof ProxyCacheAdapterFake); } public function testDisableContainer() { $factory = new ProxyCacheFactoryFake([ 'argOne' => 'one', 'container' => ProxyCacheAdapterFake::class, ]); $result = $factory->create('dummy', ['disable-container' => true]); $this->assertTrue($result instanceof PhpFilesCache); } } |