Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weimann <mail@michael-weimann.eu>2018-08-04 22:54:00 +0300
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-08-20 16:24:10 +0300
commit7aed47f776b8175e7947bb2b202b96a3f236bdce (patch)
tree11e0a57e9ccc47389fa9d235f0abc20f7190cad0 /tests/Settings
parentc164409ee7f921a96f95e1fe95d86fe07a98963e (diff)
Adds tests for the memory checks
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
Diffstat (limited to 'tests/Settings')
-rw-r--r--tests/Settings/Controller/CheckSetupControllerTest.php48
1 files changed, 4 insertions, 44 deletions
diff --git a/tests/Settings/Controller/CheckSetupControllerTest.php b/tests/Settings/Controller/CheckSetupControllerTest.php
index 617394682e7..a7689eed801 100644
--- a/tests/Settings/Controller/CheckSetupControllerTest.php
+++ b/tests/Settings/Controller/CheckSetupControllerTest.php
@@ -78,13 +78,6 @@ class CheckSetupControllerTest extends TestCase {
/** @var MemoryInfo|MockObject */
private $memoryInfo;
- /**
- * Backup of the "memory_limit" ini value before tests.
- *
- * @var string
- */
- private $memoryLimitIniValueBeforeTest;
-
public function setUp() {
parent::setUp();
@@ -115,7 +108,7 @@ class CheckSetupControllerTest extends TestCase {
$this->lockingProvider = $this->getMockBuilder(ILockingProvider::class)->getMock();
$this->dateTimeFormatter = $this->getMockBuilder(IDateTimeFormatter::class)->getMock();
$this->memoryInfo = $this->getMockBuilder(MemoryInfo::class)
- ->setMethods(['getMemoryLimit',])
+ ->setMethods(['isMemoryLimitSufficient',])
->getMock();
$this->checkSetupController = $this->getMockBuilder('\OC\Settings\Controller\CheckSetupController')
->setConstructorArgs([
@@ -440,8 +433,8 @@ class CheckSetupControllerTest extends TestCase {
->method('hasPassedCheck')
->willReturn(true);
$this->memoryInfo
- ->method('getMemoryLimit')
- ->willReturn(512 * 1024 * 1024);
+ ->method('isMemoryLimitSufficient')
+ ->willReturn(true);
$expected = new DataResponse(
[
@@ -483,7 +476,7 @@ class CheckSetupControllerTest extends TestCase {
'missingIndexes' => [],
'isPhpMailerUsed' => false,
'mailSettingsDocumentation' => 'https://server/index.php/settings/admin',
- 'isTheMemoryLimitHighEnough' => true,
+ 'isMemoryLimitSufficient' => true,
]
);
$this->assertEquals($expected, $this->checkSetupController->check());
@@ -1180,37 +1173,4 @@ Array
);
$this->assertEquals($expected, $this->checkSetupController->getFailedIntegrityCheckFiles());
}
-
- /**
- * This function returns test values for the memory limit check.
- * 1. the memory limit
- * 2. the expected check value
- *
- * @return array
- */
- public function getMemoryLimitTestData(): array {
- return [
- 'unlimited' => [-1, true,],
- '512M' => [512 * 1024 * 1024, true,],
- '1G' => [1024 * 1024 * 1024, true,],
- '64M' => [64 * 1024 * 1024, false,],
- ];
- }
-
- /**
- * Tests that if the memory limit is high enough, there is no message.
- *
- * @param string $memoryLimit The memory limit reported by MemoryInfo.
- * @param bool $expected The expected memory check return value.
- * @dataProvider getMemoryLimitTestData
- */
- public function testMemoryLimit(string $memoryLimit, bool $expected) {
- $this->memoryInfo
- ->method('getMemoryLimit')
- ->willReturn($memoryLimit);
- $this->assertSame(
- $expected,
- $this->invokePrivate($this->checkSetupController, 'isTheMemoryLimitHighEnough')
- );
- }
}