diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-02-23 23:56:28 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-02-24 10:34:14 +0300 |
commit | f3bfacc976c2e0969f52c162120273e81730a817 (patch) | |
tree | f5973c3986520de9adb2d14a3e50a9f7457b83e7 /tests/lib/App/AppStore/Fetcher/FetcherBase.php | |
parent | cfb6223de72a242e63d6ccf8b811f25958240dd0 (diff) |
Fix unit tests and improve appstore logic
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests/lib/App/AppStore/Fetcher/FetcherBase.php')
-rw-r--r-- | tests/lib/App/AppStore/Fetcher/FetcherBase.php | 129 |
1 files changed, 127 insertions, 2 deletions
diff --git a/tests/lib/App/AppStore/Fetcher/FetcherBase.php b/tests/lib/App/AppStore/Fetcher/FetcherBase.php index 73fcbbaab6f..1cec5270000 100644 --- a/tests/lib/App/AppStore/Fetcher/FetcherBase.php +++ b/tests/lib/App/AppStore/Fetcher/FetcherBase.php @@ -55,16 +55,22 @@ abstract class FetcherBase extends TestCase { $this->clientService = $this->createMock(IClientService::class); $this->timeFactory = $this->createMock(ITimeFactory::class); $this->config = $this->createMock(IConfig::class); + } + public function testGetWithAlreadyExistingFileAndUpToDateTimestampAndVersion() { $this->config + ->expects($this->at(0)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(1)) ->method('getSystemValue') ->with( $this->equalTo('version'), $this->anything() )->willReturn('11.0.0.2'); - } - public function testGetWithAlreadyExistingFileAndUpToDateTimestampAndVersion() { $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $this->appData @@ -95,6 +101,24 @@ abstract class FetcherBase extends TestCase { } public function testGetWithNotExistingFileAndUpToDateTimestampAndVersion() { + $this->config + ->expects($this->at(0)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(1)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(2)) + ->method('getSystemValue') + ->with( + $this->equalTo('version'), + $this->anything() + )->willReturn('11.0.0.2'); + $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $this->appData @@ -157,6 +181,24 @@ abstract class FetcherBase extends TestCase { } public function testGetWithAlreadyExistingFileAndOutdatedTimestamp() { + $this->config + ->expects($this->at(0)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(1)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(2)) + ->method('getSystemValue') + ->with( + $this->equalTo('version'), + $this->anything() + )->willReturn('11.0.0.2'); + $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $this->appData @@ -222,6 +264,24 @@ abstract class FetcherBase extends TestCase { } public function testGetWithAlreadyExistingFileAndNoVersion() { + $this->config + ->expects($this->at(0)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(1)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(2)) + ->method('getSystemValue') + ->with( + $this->equalTo('version'), + $this->anything() + )->willReturn('11.0.0.2'); + $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $this->appData @@ -283,6 +343,24 @@ abstract class FetcherBase extends TestCase { } public function testGetWithAlreadyExistingFileAndOutdatedVersion() { + $this->config + ->expects($this->at(0)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(1)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(2)) + ->method('getSystemValue') + ->with( + $this->equalTo('version'), + $this->anything() + )->willReturn('11.0.0.2'); + $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $this->appData @@ -343,6 +421,17 @@ abstract class FetcherBase extends TestCase { } public function testGetWithExceptionInClient() { + $this->config + ->expects($this->at(0)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(1)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $this->appData @@ -378,6 +467,24 @@ abstract class FetcherBase extends TestCase { } public function testGetMatchingETag() { + $this->config + ->expects($this->at(0)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(1)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(2)) + ->method('getSystemValue') + ->with( + $this->equalTo('version'), + $this->anything() + )->willReturn('11.0.0.2'); + $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $this->appData @@ -447,6 +554,24 @@ abstract class FetcherBase extends TestCase { } public function testGetNoMatchingETag() { + $this->config + ->expects($this->at(0)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(1)) + ->method('getSystemValue') + ->with('appstoreenabled', true) + ->willReturn(true); + $this->config + ->expects($this->at(2)) + ->method('getSystemValue') + ->with( + $this->equalTo('version'), + $this->anything() + )->willReturn('11.0.0.2'); + $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $this->appData |