diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-06-04 17:20:01 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-06-06 17:55:01 +0300 |
commit | 393d9aae74862e14e80223e44880f4f706c88d6f (patch) | |
tree | 37e2db4534c2c5f3f29672228e88543d1895c74f /tests | |
parent | f13c2b20b6fa2048b30687aa3a85e706b70f2500 (diff) |
Add a hint that some indexes are not added yet
* gives the admin a chance to discover the missing indexes and improve the performance of the instance without digging through the manual
* nicely integrated in the setup checks where this kind of hints belong to
* also adds an option to integrate this from an app based on events
* fix style of setting warnings
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Settings/Controller/CheckSetupControllerTest.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/Settings/Controller/CheckSetupControllerTest.php b/tests/Settings/Controller/CheckSetupControllerTest.php index 9faf4a4b719..7760be16499 100644 --- a/tests/Settings/Controller/CheckSetupControllerTest.php +++ b/tests/Settings/Controller/CheckSetupControllerTest.php @@ -34,6 +34,7 @@ use OCP\IRequest; use OCP\IURLGenerator; use OC_Util; use Psr\Http\Message\ResponseInterface; +use Symfony\Component\EventDispatcher\EventDispatcher; use Test\TestCase; use OC\IntegrityCheck\Checker; @@ -61,6 +62,8 @@ class CheckSetupControllerTest extends TestCase { private $logger; /** @var Checker | \PHPUnit_Framework_MockObject_MockObject */ private $checker; + /** @var EventDispatcher|\PHPUnit_Framework_MockObject_MockObject */ + private $dispatcher; public function setUp() { parent::setUp(); @@ -82,6 +85,8 @@ class CheckSetupControllerTest extends TestCase { ->will($this->returnCallback(function($message, array $replace) { return vsprintf($message, $replace); })); + $this->dispatcher = $this->getMockBuilder(EventDispatcher::class) + ->disableOriginalConstructor()->getMock(); $this->checker = $this->getMockBuilder('\OC\IntegrityCheck\Checker') ->disableOriginalConstructor()->getMock(); $this->logger = $this->getMockBuilder(ILogger::class)->getMock(); @@ -95,9 +100,10 @@ class CheckSetupControllerTest extends TestCase { $this->util, $this->l10n, $this->checker, - $this->logger + $this->logger, + $this->dispatcher, ]) - ->setMethods(['getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup', 'hasFreeTypeSupport'])->getMock(); + ->setMethods(['getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup', 'hasFreeTypeSupport', 'hasMissingIndexes'])->getMock(); } public function testIsInternetConnectionWorkingDisabledViaConfig() { @@ -329,6 +335,9 @@ class CheckSetupControllerTest extends TestCase { $this->checkSetupController ->method('hasFreeTypeSupport') ->willReturn(false); + $this->checkSetupController + ->method('hasMissingIndexes') + ->willReturn([]); $expected = new DataResponse( [ @@ -351,6 +360,7 @@ class CheckSetupControllerTest extends TestCase { 'phpOpcacheDocumentation' => 'http://docs.example.org/server/go.php?to=admin-php-opcache', 'isSettimelimitAvailable' => true, 'hasFreeTypeSupport' => false, + 'hasMissingIndexes' => [], ] ); $this->assertEquals($expected, $this->checkSetupController->check()); @@ -367,7 +377,8 @@ class CheckSetupControllerTest extends TestCase { $this->util, $this->l10n, $this->checker, - $this->logger + $this->logger, + $this->dispatcher, ]) ->setMethods(null)->getMock(); |