aboutsummaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-09-25 15:33:40 +0200
committerJoas Schilling <coding@schilljs.com>2023-09-25 15:54:21 +0200
commit0956b493b6394a6ea3c748fa5dd0910bc697ba8a (patch)
treebe06005539d5f7d38fb36352578fd841506ee304 /apps/provisioning_api/tests
parent5092278b0f4bf1905fe08d51ad329682b6e8f410 (diff)
downloadnextcloud-server-0956b493b6394a6ea3c748fa5dd0910bc697ba8a.tar.gz
nextcloud-server-0956b493b6394a6ea3c748fa5dd0910bc697ba8a.zip
fix(phonenumber): Use the newly introduced API to limit 3rdparty lib usage
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/provisioning_api/tests')
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index 56a47f23a5c..a48461c0a27 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -46,6 +46,7 @@ use Exception;
use OC\Authentication\Token\RemoteWipe;
use OC\Group\Manager;
use OC\KnownUser\KnownUserService;
+use OC\PhoneNumberUtil;
use OC\SubAdmin;
use OCA\Provisioning_API\Controller\UsersController;
use OCA\Settings\Mailer\NewUserMailHelper;
@@ -59,6 +60,7 @@ use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IGroup;
use OCP\IL10N;
+use OCP\IPhoneNumberUtil;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\IUser;
@@ -103,8 +105,10 @@ class UsersControllerTest extends TestCase {
private $remoteWipe;
/** @var KnownUserService|MockObject */
private $knownUserService;
- /** @var IEventDispatcher */
+ /** @var IEventDispatcher|MockObject */
private $eventDispatcher;
+ /** @var IPhoneNumberUtil */
+ private $phoneNumberUtil;
protected function setUp(): void {
parent::setUp();
@@ -123,6 +127,7 @@ class UsersControllerTest extends TestCase {
$this->remoteWipe = $this->createMock(RemoteWipe::class);
$this->knownUserService = $this->createMock(KnownUserService::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
+ $this->phoneNumberUtil = new PhoneNumberUtil();
$this->api = $this->getMockBuilder(UsersController::class)
->setConstructorArgs([
@@ -141,8 +146,9 @@ class UsersControllerTest extends TestCase {
$this->remoteWipe,
$this->knownUserService,
$this->eventDispatcher,
+ $this->phoneNumberUtil,
])
- ->setMethods(['fillStorageInfo'])
+ ->onlyMethods(['fillStorageInfo'])
->getMock();
}
@@ -411,8 +417,9 @@ class UsersControllerTest extends TestCase {
$this->remoteWipe,
$this->knownUserService,
$this->eventDispatcher,
+ $this->phoneNumberUtil,
])
- ->setMethods(['editUser'])
+ ->onlyMethods(['editUser'])
->getMock();
$this->userManager
@@ -3693,8 +3700,9 @@ class UsersControllerTest extends TestCase {
$this->remoteWipe,
$this->knownUserService,
$this->eventDispatcher,
+ $this->phoneNumberUtil,
])
- ->setMethods(['getUserData'])
+ ->onlyMethods(['getUserData'])
->getMock();
$api->expects($this->once())->method('getUserData')->with('UID', true)
@@ -3779,8 +3787,9 @@ class UsersControllerTest extends TestCase {
$this->remoteWipe,
$this->knownUserService,
$this->eventDispatcher,
+ $this->phoneNumberUtil,
])
- ->setMethods(['getUserData'])
+ ->onlyMethods(['getUserData'])
->getMock();
$expected = [