summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Provisioning
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-01-05 18:25:31 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2023-01-05 18:28:07 +0100
commit574c6770d18f74c26ec3b72075a52333e6495a7a (patch)
tree28f0c760c0664062c2fb34becdaab7b36fea48c2 /apps/dav/tests/unit/Provisioning
parentadef2b85c8c8f771d694dedec2c8509694aee149 (diff)
downloadnextcloud-server-574c6770d18f74c26ec3b72075a52333e6495a7a.tar.gz
nextcloud-server-574c6770d18f74c26ec3b72075a52333e6495a7a.zip
Get rid of deprecated at matcher in dav application tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/dav/tests/unit/Provisioning')
-rw-r--r--apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningNodeTest.php3
-rw-r--r--apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php64
2 files changed, 33 insertions, 34 deletions
diff --git a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningNodeTest.php b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningNodeTest.php
index 2f4728f1966..e58022264a1 100644
--- a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningNodeTest.php
+++ b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningNodeTest.php
@@ -30,7 +30,6 @@ use Sabre\DAV\PropPatch;
use Test\TestCase;
class AppleProvisioningNodeTest extends TestCase {
-
/** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
@@ -69,7 +68,7 @@ class AppleProvisioningNodeTest extends TestCase {
}
public function testGetProperties() {
- $this->timeFactory->expects($this->at(0))
+ $this->timeFactory->expects($this->once())
->method('getDateTime')
->willReturn(new \DateTime('2000-01-01'));
diff --git a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php
index 5bff59cbc7c..b4d28a875b3 100644
--- a/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php
+++ b/apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php
@@ -36,7 +36,6 @@ use OCP\IUserSession;
use Test\TestCase;
class AppleProvisioningPluginTest extends TestCase {
-
/** @var \Sabre\DAV\Server|\PHPUnit\Framework\MockObject\MockObject */
protected $server;
@@ -96,7 +95,7 @@ class AppleProvisioningPluginTest extends TestCase {
function () {
});
- $server->expects($this->at(0))
+ $server->expects($this->once())
->method('on')
->with('method:GET', [$plugin, 'httpGet'], 90);
@@ -104,36 +103,36 @@ class AppleProvisioningPluginTest extends TestCase {
}
public function testHttpGetOnHttp() {
- $this->sabreRequest->expects($this->at(0))
+ $this->sabreRequest->expects($this->once())
->method('getPath')
->with()
->willReturn('provisioning/apple-provisioning.mobileconfig');
$user = $this->createMock(IUser::class);
- $this->userSession->expects($this->at(0))
+ $this->userSession->expects($this->once())
->method('getUser')
->willReturn($user);
- $this->request->expects($this->at(0))
+ $this->request->expects($this->once())
->method('getServerProtocol')
->wilLReturn('http');
- $this->themingDefaults->expects($this->at(0))
+ $this->themingDefaults->expects($this->once())
->method('getName')
->willReturn('InstanceName');
- $this->l10n->expects($this->at(0))
+ $this->l10n->expects($this->once())
->method('t')
->with('Your %s needs to be configured to use HTTPS in order to use CalDAV and CardDAV with iOS/macOS.', ['InstanceName'])
->willReturn('LocalizedErrorMessage');
- $this->sabreResponse->expects($this->at(0))
+ $this->sabreResponse->expects($this->once())
->method('setStatus')
->with(200);
- $this->sabreResponse->expects($this->at(1))
+ $this->sabreResponse->expects($this->once())
->method('setHeader')
->with('Content-Type', 'text/plain; charset=utf-8');
- $this->sabreResponse->expects($this->at(2))
+ $this->sabreResponse->expects($this->once())
->method('setBody')
->with('LocalizedErrorMessage');
@@ -143,21 +142,21 @@ class AppleProvisioningPluginTest extends TestCase {
}
public function testHttpGetOnHttps() {
- $this->sabreRequest->expects($this->at(0))
+ $this->sabreRequest->expects($this->once())
->method('getPath')
->with()
->willReturn('provisioning/apple-provisioning.mobileconfig');
$user = $this->createMock(IUser::class);
- $user->expects($this->at(0))
+ $user->expects($this->once())
->method('getUID')
->willReturn('userName');
- $this->userSession->expects($this->at(0))
+ $this->userSession->expects($this->once())
->method('getUser')
->willReturn($user);
- $this->request->expects($this->at(0))
+ $this->request->expects($this->once())
->method('getServerProtocol')
->wilLReturn('https');
@@ -165,30 +164,31 @@ class AppleProvisioningPluginTest extends TestCase {
->method('getBaseUrl')
->willReturn('https://nextcloud.tld/nextcloud');
- $this->themingDefaults->expects($this->at(0))
+ $this->themingDefaults->expects($this->once())
->method('getName')
->willReturn('InstanceName');
- $this->l10n->expects($this->at(0))
- ->method('t')
- ->with('Configures a CalDAV account')
- ->willReturn('LocalizedConfiguresCalDAV');
-
- $this->l10n->expects($this->at(1))
+ $this->l10n->expects($this->exactly(2))
->method('t')
- ->with('Configures a CardDAV account')
- ->willReturn('LocalizedConfiguresCardDAV');
-
- $this->sabreResponse->expects($this->at(0))
+ ->withConsecutive(
+ ['Configures a CalDAV account'],
+ ['Configures a CardDAV account'],
+ )
+ ->willReturnOnConsecutiveCalls(
+ 'LocalizedConfiguresCalDAV',
+ 'LocalizedConfiguresCardDAV',
+ );
+
+ $this->sabreResponse->expects($this->once())
->method('setStatus')
->with(200);
- $this->sabreResponse->expects($this->at(1))
- ->method('setHeader')
- ->with('Content-Disposition', 'attachment; filename="userName-apple-provisioning.mobileconfig"');
- $this->sabreResponse->expects($this->at(2))
+ $this->sabreResponse->expects($this->exactly(2))
->method('setHeader')
- ->with('Content-Type', 'application/xml; charset=utf-8');
- $this->sabreResponse->expects($this->at(3))
+ ->withConsecutive(
+ ['Content-Disposition', 'attachment; filename="userName-apple-provisioning.mobileconfig"'],
+ ['Content-Type', 'application/xml; charset=utf-8'],
+ );
+ $this->sabreResponse->expects($this->once())
->method('setBody')
->with(<<<EOF
<?xml version="1.0" encoding="UTF-8"?>
@@ -262,7 +262,7 @@ class AppleProvisioningPluginTest extends TestCase {
</plist>
EOF
-);
+ );
$returnValue = $this->plugin->httpGet($this->sabreRequest, $this->sabreResponse);