$this->config = $this->createMock(IConfig::class);
$this->config
- ->expects($this->atLeastOnce())
+ ->expects($this->at(0))
->method('getSystemValue')
->with('version')
->willReturn('11.0.0.2');
-
$this->fetcher = new AppFetcher(
$this->appData,
$this->clientService,
}
public function testGetWithFilter() {
+ $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('version')
+ ->willReturn('11.0.0.2');
+ $this->config
+ ->expects($this->at(3))
+ ->method('getSystemValue')
+ ->with('version')
+ ->willReturn('11.0.0.2');
+
$file = $this->createMock(ISimpleFile::class);
$folder = $this->createMock(ISimpleFolder::class);
$folder
$this->assertEquals($expected['data'], $this->fetcher->get());
}
+
+ public function testAppstoreDisabled() {
+ $this->config
+ ->expects($this->once())
+ ->method('getSystemValue')
+ ->with('appstoreenabled', true)
+ ->willReturn(false);
+ $this->appData
+ ->expects($this->never())
+ ->method('getFolder');
+
+ $this->assertEquals([], $this->fetcher->get());
+ }
}
$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
}
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
}
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
}
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
}
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
}
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
}
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
}
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