aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/IntegrityCheck
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/IntegrityCheck')
-rw-r--r--tests/lib/IntegrityCheck/CheckerTest.php9
-rw-r--r--tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php8
2 files changed, 10 insertions, 7 deletions
diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php
index 8414a531464..fc540707c70 100644
--- a/tests/lib/IntegrityCheck/CheckerTest.php
+++ b/tests/lib/IntegrityCheck/CheckerTest.php
@@ -8,6 +8,7 @@
namespace Test\IntegrityCheck;
use OC\Core\Command\Maintenance\Mimetype\GenerateMimetypeFileBuilder;
+use OC\Files\Type\Detection;
use OC\IntegrityCheck\Checker;
use OC\IntegrityCheck\Helpers\AppLocator;
use OC\IntegrityCheck\Helpers\EnvironmentHelper;
@@ -54,7 +55,7 @@ class CheckerTest extends TestCase {
$this->appConfig = $this->createMock(IAppConfig::class);
$this->cacheFactory = $this->createMock(ICacheFactory::class);
$this->appManager = $this->createMock(IAppManager::class);
- $this->mimeTypeDetector = $this->createMock(\OC\Files\Type\Detection::class);
+ $this->mimeTypeDetector = $this->createMock(Detection::class);
$this->config->method('getAppValue')
->willReturnArgument(2);
@@ -111,7 +112,7 @@ class CheckerTest extends TestCase {
$this->fileAccessHelper
->expects($this->once())
->method('file_put_contents')
- ->will($this->throwException(new \Exception('Exception message')));
+ ->willThrowException(new \Exception('Exception message'));
$keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt');
$rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key');
@@ -445,7 +446,7 @@ class CheckerTest extends TestCase {
$this->fileAccessHelper
->expects($this->once())
->method('assertDirectoryExists')
- ->will($this->throwException(new \Exception('Exception message')));
+ ->willThrowException(new \Exception('Exception message'));
$this->fileAccessHelper
->expects($this->once())
->method('is_writable')
@@ -469,7 +470,7 @@ class CheckerTest extends TestCase {
$this->fileAccessHelper
->expects($this->once())
->method('assertDirectoryExists')
- ->will($this->throwException(new \Exception('Exception message')));
+ ->willThrowException(new \Exception('Exception message'));
$this->fileAccessHelper
->expects($this->once())
->method('is_writable')
diff --git a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php
index 866850b7cff..ef537155388 100644
--- a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php
+++ b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php
@@ -8,6 +8,8 @@
namespace Test\IntegrityCheck\Helpers;
use OC\IntegrityCheck\Helpers\FileAccessHelper;
+use OCP\ITempManager;
+use OCP\Server;
use Test\TestCase;
class FileAccessHelperTest extends TestCase {
@@ -20,7 +22,7 @@ class FileAccessHelperTest extends TestCase {
}
public function testReadAndWrite(): void {
- $tempManager = \OC::$server->getTempManager();
+ $tempManager = Server::get(ITempManager::class);
$filePath = $tempManager->getTemporaryFile();
$data = 'SomeDataGeneratedByIntegrityCheck';
@@ -38,7 +40,7 @@ class FileAccessHelperTest extends TestCase {
public function testIs_writable(): void {
$this->assertFalse($this->fileAccessHelper->is_writable('/anabsolutelynotexistingfolder/on/the/system.txt'));
- $this->assertTrue($this->fileAccessHelper->is_writable(\OC::$server->getTempManager()->getTemporaryFile('MyFile')));
+ $this->assertTrue($this->fileAccessHelper->is_writable(Server::get(ITempManager::class)->getTemporaryFile('MyFile')));
}
@@ -50,7 +52,7 @@ class FileAccessHelperTest extends TestCase {
}
public function testAssertDirectoryExists(): void {
- $this->fileAccessHelper->assertDirectoryExists(\OC::$server->getTempManager()->getTemporaryFolder('/testfolder/'));
+ $this->fileAccessHelper->assertDirectoryExists(Server::get(ITempManager::class)->getTemporaryFolder('/testfolder/'));
$this->addToAssertionCount(1);
}
}