diff options
Diffstat (limited to 'tests/lib/Cache')
-rw-r--r-- | tests/lib/Cache/CappedMemoryCacheTest.php | 4 | ||||
-rw-r--r-- | tests/lib/Cache/FileCacheTest.php | 19 | ||||
-rw-r--r-- | tests/lib/Cache/TestCache.php | 6 |
3 files changed, 15 insertions, 14 deletions
diff --git a/tests/lib/Cache/CappedMemoryCacheTest.php b/tests/lib/Cache/CappedMemoryCacheTest.php index 00231004fe5..db0d2bd1193 100644 --- a/tests/lib/Cache/CappedMemoryCacheTest.php +++ b/tests/lib/Cache/CappedMemoryCacheTest.php @@ -49,7 +49,7 @@ class CappedMemoryCacheTest extends TestCache { $this->assertTrue($instance->hasKey('5')); } - function testClear() { + public function testClear() { $value = 'ipsum lorum'; $this->instance->set('1_value1', $value); $this->instance->set('1_value2', $value); @@ -63,7 +63,7 @@ class CappedMemoryCacheTest extends TestCache { $this->assertFalse($this->instance->hasKey('3_value1')); } - function testIndirectSet() { + public function testIndirectSet() { $this->instance->set('array', []); $this->instance['array'][] = 'foo'; diff --git a/tests/lib/Cache/FileCacheTest.php b/tests/lib/Cache/FileCacheTest.php index 450bdf607b3..1a28724ae12 100644 --- a/tests/lib/Cache/FileCacheTest.php +++ b/tests/lib/Cache/FileCacheTest.php @@ -21,6 +21,7 @@ */ namespace Test\Cache; + use OC\Files\Storage\Local; /** @@ -48,7 +49,7 @@ class FileCacheTest extends TestCache { * */ private $rootView; - function skip() { + public function skip() { //$this->skipUnless(OC_User::isLoggedIn()); } @@ -61,8 +62,8 @@ class FileCacheTest extends TestCache { //set up temporary storage $this->storage = \OC\Files\Filesystem::getStorage('/'); \OC\Files\Filesystem::clearMounts(); - $storage = new \OC\Files\Storage\Temporary(array()); - \OC\Files\Filesystem::mount($storage,array(),'/'); + $storage = new \OC\Files\Storage\Temporary([]); + \OC\Files\Filesystem::mount($storage,[],'/'); $datadir = str_replace('local::', '', $storage->getId()); $config = \OC::$server->getConfig(); $this->datadir = $config->getSystemValue('cachedirectory', \OC::$SERVERROOT.'/data/cache'); @@ -106,7 +107,7 @@ class FileCacheTest extends TestCache { // Restore the original mount point \OC\Files\Filesystem::clearMounts(); - \OC\Files\Filesystem::mount($this->storage, array(), '/'); + \OC\Files\Filesystem::mount($this->storage, [], '/'); parent::tearDown(); } @@ -117,7 +118,7 @@ class FileCacheTest extends TestCache { ->setConstructorArgs([['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]]) ->getMock(); - \OC\Files\Filesystem::mount($mockStorage, array(), '/test/cache'); + \OC\Files\Filesystem::mount($mockStorage, [], '/test/cache'); return $mockStorage; } @@ -127,11 +128,11 @@ class FileCacheTest extends TestCache { $mockStorage->expects($this->atLeastOnce()) ->method('filemtime') - ->will($this->returnValue(100)); + ->willReturn(100); $mockStorage->expects($this->once()) ->method('unlink') ->with('key1') - ->will($this->returnValue(true)); + ->willReturn(true); $this->instance->set('key1', 'value1'); $this->instance->gc(); @@ -142,7 +143,7 @@ class FileCacheTest extends TestCache { $mockStorage->expects($this->atLeastOnce()) ->method('filemtime') - ->will($this->returnValue(time() + 3600)); + ->willReturn(time() + 3600); $mockStorage->expects($this->never()) ->method('unlink') ->with('key1'); @@ -165,7 +166,7 @@ class FileCacheTest extends TestCache { $mockStorage->expects($this->atLeastOnce()) ->method('filemtime') - ->will($this->returnValue(100)); + ->willReturn(100); $mockStorage->expects($this->atLeastOnce()) ->method('unlink') ->will($this->onConsecutiveCalls( diff --git a/tests/lib/Cache/TestCache.php b/tests/lib/Cache/TestCache.php index 62341a5698b..9dfc46eb5a0 100644 --- a/tests/lib/Cache/TestCache.php +++ b/tests/lib/Cache/TestCache.php @@ -15,14 +15,14 @@ abstract class TestCache extends \Test\TestCase { protected $instance; protected function tearDown(): void { - if($this->instance) { + if ($this->instance) { $this->instance->clear(); } parent::tearDown(); } - function testSimple() { + public function testSimple() { $this->assertNull($this->instance->get('value1')); $this->assertFalse($this->instance->hasKey('value1')); @@ -51,7 +51,7 @@ abstract class TestCache extends \Test\TestCase { $this->assertFalse($this->instance->hasKey('value1')); } - function testClear() { + public function testClear() { $value='ipsum lorum'; $this->instance->set('1_value1', $value . '1'); $this->instance->set('1_value2', $value . '2'); |