diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-03-02 12:12:19 -0600 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-03-02 21:53:36 -0600 |
commit | 0b12eb06403687d700fdcfc130f3dcc7164518ea (patch) | |
tree | 0e682ff568a92e8af82d5eeb182480b33fa0bc75 /tests/lib/Repair | |
parent | 53195b156c68082f1e02e45ba2a266c15ef1bcaa (diff) | |
download | nextcloud-server-0b12eb06403687d700fdcfc130f3dcc7164518ea.tar.gz nextcloud-server-0b12eb06403687d700fdcfc130f3dcc7164518ea.zip |
Execute UpdateLanguageCode only once
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests/lib/Repair')
-rw-r--r-- | tests/lib/Repair/NC12/UpdateLanguageCodesTest.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/lib/Repair/NC12/UpdateLanguageCodesTest.php b/tests/lib/Repair/NC12/UpdateLanguageCodesTest.php index 95ccd0935a1..dfb5ea099f7 100644 --- a/tests/lib/Repair/NC12/UpdateLanguageCodesTest.php +++ b/tests/lib/Repair/NC12/UpdateLanguageCodesTest.php @@ -24,6 +24,7 @@ namespace Test\Repair\NC12; use OC\Repair\NC12\UpdateLanguageCodes; +use OCP\IConfig; use OCP\Migration\IOutput; use Test\TestCase; @@ -38,10 +39,14 @@ class UpdateLanguageCodesTest extends TestCase { /** @var \OCP\IDBConnection */ protected $connection; + /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */ + private $config; + protected function setUp() { parent::setUp(); $this->connection = \OC::$server->getDatabaseConnection(); + $this->config = $this->createMock(IConfig::class); } public function testRun() { @@ -112,8 +117,13 @@ class UpdateLanguageCodesTest extends TestCase { ->method('info') ->with('Changed 2 setting(s) from "th_TH" to "th" in preferences table.'); + $this->config->expects($this->once()) + ->method('getSystemValue') + ->with('version', '0.0.0') + ->willReturn('12.0.0.13'); + // run repair step - $repair = new UpdateLanguageCodes($this->connection); + $repair = new UpdateLanguageCodes($this->connection, $this->config); $repair->run($outputMock); // check if test data is correctly modified in DB @@ -147,4 +157,18 @@ class UpdateLanguageCodesTest extends TestCase { } } + public function testSecondRun() { + /** @var IOutput|\PHPUnit_Framework_MockObject_MockObject $outputMock */ + $outputMock = $this->createMock(IOutput::class); + + $this->config->expects($this->once()) + ->method('getSystemValue') + ->with('version', '0.0.0') + ->willReturn('12.0.0.14'); + + // run repair step + $repair = new UpdateLanguageCodes($this->connection, $this->config); + $repair->run($outputMock); + } + } |