diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-02-06 11:22:09 +0100 |
---|---|---|
committer | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2024-02-08 10:28:29 +0100 |
commit | 166773879ba20bf7b81f3996a7c4e2a9ff7ee16d (patch) | |
tree | ee8c3115167e71c115f56479612be08c574761f1 /apps/user_ldap | |
parent | 9e9040196f94e9650ce847e9feb9f23ad8d19ada (diff) | |
download | nextcloud-server-166773879ba20bf7b81f3996a7c4e2a9ff7ee16d.tar.gz nextcloud-server-166773879ba20bf7b81f3996a7c4e2a9ff7ee16d.zip |
fix!: Migrate jobs away from deprecated interfaces
BREAKING CHANGE: Removed ILogFactory::getCustomLogger deprecated method
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/lib/Migration/UUIDFix.php | 9 | ||||
-rw-r--r-- | apps/user_ldap/lib/Migration/UUIDFixGroup.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/lib/Migration/UUIDFixUser.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php | 43 |
4 files changed, 24 insertions, 36 deletions
diff --git a/apps/user_ldap/lib/Migration/UUIDFix.php b/apps/user_ldap/lib/Migration/UUIDFix.php index 74ab65d347c..e36ddd1140f 100644 --- a/apps/user_ldap/lib/Migration/UUIDFix.php +++ b/apps/user_ldap/lib/Migration/UUIDFix.php @@ -23,17 +23,14 @@ */ namespace OCA\User_LDAP\Migration; -use OC\BackgroundJob\QueuedJob; use OCA\User_LDAP\Mapping\AbstractMapping; use OCA\User_LDAP\Proxy; use OCA\User_LDAP\User_Proxy; +use OCP\BackgroundJob\QueuedJob; abstract class UUIDFix extends QueuedJob { - /** @var AbstractMapping */ - protected $mapper; - - /** @var Proxy */ - protected $proxy; + protected AbstractMapping $mapper; + protected Proxy $proxy; public function run($argument) { $isUser = $this->proxy instanceof User_Proxy; diff --git a/apps/user_ldap/lib/Migration/UUIDFixGroup.php b/apps/user_ldap/lib/Migration/UUIDFixGroup.php index a90dcb5a938..c0ed3f9d48d 100644 --- a/apps/user_ldap/lib/Migration/UUIDFixGroup.php +++ b/apps/user_ldap/lib/Migration/UUIDFixGroup.php @@ -24,9 +24,11 @@ namespace OCA\User_LDAP\Migration; use OCA\User_LDAP\Group_Proxy; use OCA\User_LDAP\Mapping\GroupMapping; +use OCP\AppFramework\Utility\ITimeFactory; class UUIDFixGroup extends UUIDFix { - public function __construct(GroupMapping $mapper, Group_Proxy $proxy) { + public function __construct(ITimeFactory $time, GroupMapping $mapper, Group_Proxy $proxy) { + parent::__construct($time); $this->mapper = $mapper; $this->proxy = $proxy; } diff --git a/apps/user_ldap/lib/Migration/UUIDFixUser.php b/apps/user_ldap/lib/Migration/UUIDFixUser.php index bd6aed44a0a..3f811e434ad 100644 --- a/apps/user_ldap/lib/Migration/UUIDFixUser.php +++ b/apps/user_ldap/lib/Migration/UUIDFixUser.php @@ -24,9 +24,11 @@ namespace OCA\User_LDAP\Migration; use OCA\User_LDAP\Mapping\UserMapping; use OCA\User_LDAP\User_Proxy; +use OCP\AppFramework\Utility\ITimeFactory; class UUIDFixUser extends UUIDFix { - public function __construct(UserMapping $mapper, User_Proxy $proxy) { + public function __construct(ITimeFactory $time, UserMapping $mapper, User_Proxy $proxy) { + parent::__construct($time); $this->mapper = $mapper; $this->proxy = $proxy; } diff --git a/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php b/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php index 7cb666b2514..ca06bb9ddbd 100644 --- a/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php +++ b/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php @@ -27,37 +27,23 @@ namespace OCA\User_LDAP\Tests\Migration; use OCA\User_LDAP\Access; use OCA\User_LDAP\Helper; use OCA\User_LDAP\LDAP; -use OCA\User_LDAP\Mapping\GroupMapping; -use OCA\User_LDAP\Mapping\UserMapping; -use OCA\User_LDAP\Migration\UUIDFixUser; -use OCA\User_LDAP\User_Proxy; +use OCA\User_LDAP\Mapping\AbstractMapping; +use OCA\User_LDAP\Migration\UUIDFix; +use OCA\User_LDAP\Proxy; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\IConfig; use Test\TestCase; abstract class AbstractUUIDFixTest extends TestCase { - /** @var Helper|\PHPUnit\Framework\MockObject\MockObject */ - protected $helper; - - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ - protected $config; - - /** @var LDAP|\PHPUnit\Framework\MockObject\MockObject */ - protected $ldap; - - /** @var UserMapping|GroupMapping|\PHPUnit\Framework\MockObject\MockObject */ - protected $mapper; - - /** @var UUIDFixUser */ - protected $job; - - /** @var User_Proxy|\PHPUnit\Framework\MockObject\MockObject */ - protected $proxy; - - /** @var Access|\PHPUnit\Framework\MockObject\MockObject */ - protected $access; - - /** @var bool */ - protected $isUser = true; + protected Helper $helper; + protected IConfig $config; + protected LDAP $ldap; + protected AbstractMapping $mapper; + protected UUIDFix $job; + protected Proxy $proxy; + protected Access $access; + protected ITimeFactory $time; + protected bool $isUser = true; protected function setUp(): void { parent::setUp(); @@ -65,6 +51,7 @@ abstract class AbstractUUIDFixTest extends TestCase { $this->ldap = $this->createMock(LDAP::class); $this->config = $this->createMock(IConfig::class); $this->access = $this->createMock(Access::class); + $this->time = $this->createMock(ITimeFactory::class); $this->helper = $this->createMock(Helper::class); $this->helper->expects($this->any()) @@ -74,7 +61,7 @@ abstract class AbstractUUIDFixTest extends TestCase { } protected function instantiateJob($className) { - $this->job = new $className($this->mapper, $this->proxy); + $this->job = new $className($this->time, $this->mapper, $this->proxy); $this->proxy->expects($this->any()) ->method('getLDAPAccess') ->willReturn($this->access); |