-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! fixup! fixup! fixup! chore(legacy): Introduce public version c…
…lass and drop version methods from OC_Util
- Loading branch information
1 parent
6ccceca
commit 4c8e2bc
Showing
5 changed files
with
85 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc. | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
namespace OC\IntegrityCheck\Helpers; | ||
|
||
/** | ||
* Class EnvironmentHelper provides a non-static helper for access to static | ||
* variables such as \OC::$SERVERROOT. | ||
* | ||
* @package OC\IntegrityCheck\Helpers | ||
*/ | ||
class EnvironmentHelper { | ||
/** | ||
* Provides \OC::$SERVERROOT | ||
* | ||
* @return string | ||
*/ | ||
public function getServerRoot(): string { | ||
return rtrim(\OC::$SERVERROOT, '/'); | ||
} | ||
|
||
/** | ||
* Provides \OC_Util::getChannel() | ||
* | ||
* @return string | ||
*/ | ||
public function getChannel(): string { | ||
return \OC_Util::getChannel(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
/** | ||
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-FileCopyrightText: 2016 ownCloud, Inc. | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
namespace Test\IntegrityCheck\Helpers; | ||
|
||
use OC\IntegrityCheck\Helpers\EnvironmentHelper; | ||
use Test\TestCase; | ||
|
||
class EnvironmentHelperTest extends TestCase { | ||
/** @var EnvironmentHelper */ | ||
private $environmentHelper; | ||
|
||
protected function setUp(): void { | ||
$this->environmentHelper = new EnvironmentHelper(); | ||
parent::setUp(); | ||
} | ||
|
||
public function testGetServerRoot(): void { | ||
$this->assertSame(\OC::$SERVERROOT, $this->environmentHelper->getServerRoot()); | ||
} | ||
|
||
public function testGetChannel(): void { | ||
$this->assertSame(\OC_Util::getChannel(), $this->environmentHelper->getChannel()); | ||
} | ||
} |