aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Files/Storage/Wrapper/AvailabilityTest.php')
-rw-r--r--tests/lib/Files/Storage/Wrapper/AvailabilityTest.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php
index 616fd023414..d890081cbb6 100644
--- a/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php
+++ b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -53,7 +54,7 @@ class AvailabilityTest extends \Test\TestCase {
*
*/
public function testUnavailable(): void {
- $this->expectException(\OCP\Files\StorageNotAvailableException::class);
+ $this->expectException(StorageNotAvailableException::class);
$this->storage->expects($this->once())
->method('getAvailability')
@@ -76,12 +77,16 @@ class AvailabilityTest extends \Test\TestCase {
$this->storage->expects($this->once())
->method('test')
->willReturn(true);
+ $calls = [
+ false, // prevents concurrent rechecks
+ true, // sets correct availability
+ ];
$this->storage->expects($this->exactly(2))
->method('setAvailability')
- ->withConsecutive(
- [$this->equalTo(false)], // prevents concurrent rechecks
- [$this->equalTo(true)] // sets correct availability
- );
+ ->willReturnCallback(function ($value) use (&$calls): void {
+ $expected = array_shift($calls);
+ $this->assertEquals($expected, $value);
+ });
$this->storage->expects($this->once())
->method('mkdir');
@@ -93,7 +98,7 @@ class AvailabilityTest extends \Test\TestCase {
*
*/
public function testAvailableThrowStorageNotAvailable(): void {
- $this->expectException(\OCP\Files\StorageNotAvailableException::class);
+ $this->expectException(StorageNotAvailableException::class);
$this->storage->expects($this->once())
->method('getAvailability')
@@ -102,7 +107,7 @@ class AvailabilityTest extends \Test\TestCase {
->method('test');
$this->storage->expects($this->once())
->method('mkdir')
- ->will($this->throwException(new StorageNotAvailableException()));
+ ->willThrowException(new StorageNotAvailableException());
$this->storageCache->expects($this->once())
->method('setAvailability')
->with($this->equalTo(false));
@@ -144,7 +149,7 @@ class AvailabilityTest extends \Test\TestCase {
->method('test');
$this->storage->expects($this->once())
->method('mkdir')
- ->will($this->throwException(new \Exception()));
+ ->willThrowException(new \Exception());
$this->storage->expects($this->never())
->method('setAvailability');