refactor(tests): `getMockForTrait` is deprecated

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/55870/head
Ferdinand Thiessen 2025-10-21 00:24:24 +07:00
parent be6b39f280
commit b7488550f7
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
2 changed files with 30 additions and 1 deletions

@ -18,7 +18,12 @@ class CasTraitTest extends TestCase {
*/
private function getCache() {
$sourceCache = new ArrayCache();
$mock = $this->getMockForTrait('\OC\Memcache\CasTrait');
$mock = $this->getMockBuilder(CasTraitTestClass::class)->onlyMethods([
'set',
'get',
'add',
'remove',
])->getMock();
$mock->expects($this->any())
->method('set')

@ -0,0 +1,24 @@
<?php
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace Test\Memcache;
use OC\Memcache\CASTrait;
class CasTraitTestClass {
use CASTrait;
// abstract methods from Memcache
public function set($key, $value, $ttl = 0) {
}
public function get($key) {
}
public function add($key, $value, $ttl = 0) {
}
public function remove($key) {
}
}