diff options
Diffstat (limited to 'tests/lib/UtilCheckServerTest.php')
-rw-r--r-- | tests/lib/UtilCheckServerTest.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/lib/UtilCheckServerTest.php b/tests/lib/UtilCheckServerTest.php index ca4cd7d108f..accac40112a 100644 --- a/tests/lib/UtilCheckServerTest.php +++ b/tests/lib/UtilCheckServerTest.php @@ -7,6 +7,11 @@ namespace Test; +use OCP\ISession; +use OCP\ITempManager; +use OCP\Server; +use OCP\Util; + /** * Tests for server check functions * @@ -37,10 +42,10 @@ class UtilCheckServerTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->datadir = \OC::$server->getTempManager()->getTemporaryFolder(); + $this->datadir = Server::get(ITempManager::class)->getTemporaryFolder(); file_put_contents($this->datadir . '/.ncdata', '# Nextcloud data directory'); - \OC::$server->getSession()->set('checkServer_succeeded', false); + Server::get(ISession::class)->set('checkServer_succeeded', false); } protected function tearDown(): void { @@ -85,7 +90,7 @@ class UtilCheckServerTest extends \Test\TestCase { // simulate old version that didn't have it unlink($this->datadir . '/.ncdata'); - $session = \OC::$server->getSession(); + $session = Server::get(ISession::class); $oldCurrentVersion = $session->get('OC_Version'); // upgrade condition to simulate needUpgrade() === true @@ -123,7 +128,7 @@ class UtilCheckServerTest extends \Test\TestCase { $result = \OC_Util::checkServer($this->getConfig([ 'installed' => true, - 'version' => implode('.', \OCP\Util::getVersion()) + 'version' => implode('.', Util::getVersion()) ])); $this->assertCount(1, $result); } @@ -134,7 +139,7 @@ class UtilCheckServerTest extends \Test\TestCase { public function testDataDirWritable(): void { $result = \OC_Util::checkServer($this->getConfig([ 'installed' => true, - 'version' => implode('.', \OCP\Util::getVersion()) + 'version' => implode('.', Util::getVersion()) ])); $this->assertEmpty($result); } @@ -148,7 +153,7 @@ class UtilCheckServerTest extends \Test\TestCase { chmod($this->datadir, 0300); $result = \OC_Util::checkServer($this->getConfig([ 'installed' => true, - 'version' => implode('.', \OCP\Util::getVersion()) + 'version' => implode('.', Util::getVersion()) ])); $this->assertCount(1, $result); } @@ -160,7 +165,7 @@ class UtilCheckServerTest extends \Test\TestCase { chmod($this->datadir, 0300); $result = \OC_Util::checkServer($this->getConfig([ 'installed' => false, - 'version' => implode('.', \OCP\Util::getVersion()) + 'version' => implode('.', Util::getVersion()) ])); chmod($this->datadir, 0700); //needed for cleanup $this->assertEmpty($result); |