diff options
Diffstat (limited to 'tests/lib/InstallerTest.php')
-rw-r--r-- | tests/lib/InstallerTest.php | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php index 107b9dcb41f..68f3676faa8 100644 --- a/tests/lib/InstallerTest.php +++ b/tests/lib/InstallerTest.php @@ -40,9 +40,6 @@ class InstallerTest extends TestCase { /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */ private $config; - /** @var Installer */ - private $installer; - protected function setUp() { parent::setUp(); @@ -51,13 +48,6 @@ class InstallerTest extends TestCase { $this->tempManager = $this->createMock(ITempManager::class); $this->logger = $this->createMock(ILogger::class); $this->config = $this->createMock(IConfig::class); - $this->installer = new Installer( - $this->appFetcher, - $this->clientService, - $this->tempManager, - $this->logger, - $this->config - ); $config = \OC::$server->getConfig(); $this->appstore = $config->setSystemValue('appstoreenabled', true); @@ -72,6 +62,16 @@ class InstallerTest extends TestCase { $installer->removeApp(self::$appid); } + protected function getInstaller() { + return new Installer( + $this->appFetcher, + $this->clientService, + $this->tempManager, + $this->logger, + $this->config + ); + } + protected function tearDown() { $installer = new Installer( \OC::$server->getAppFetcher(), @@ -197,7 +197,8 @@ gLgK8d8sKL60JMmKHN3boHrsThKBVA== ->willReturn($appArray); - $this->installer->downloadApp('news'); + $installer = $this->getInstaller(); + $installer->downloadApp('news'); } /** @@ -239,7 +240,8 @@ YSu356M= ->method('get') ->willReturn($appArray); - $this->installer->downloadApp('news'); + $installer = $this->getInstaller(); + $installer->downloadApp('news'); } /** @@ -281,7 +283,8 @@ cR92p/PYCFXkAKP3OO0RPlf6dXNKTw== ->method('get') ->willReturn($appArray); - $this->installer->downloadApp('news'); + $installer = $this->getInstaller(); + $installer->downloadApp('news'); } /** @@ -348,7 +351,8 @@ cR92p/PYCFXkAKP3OO0RPlf6dXNKTw== ->method('newClient') ->willReturn($client); - $this->installer->downloadApp('passman'); + $installer = $this->getInstaller(); + $installer->downloadApp('passman'); } /** @@ -431,7 +435,8 @@ YwDVP+QmNRzx72jtqAN/Kc3CvQ9nkgYhU65B95aX0xA=', ->method('newClient') ->willReturn($client); - $this->installer->downloadApp('testapp'); + $installer = $this->getInstaller(); + $installer->downloadApp('testapp'); } /** @@ -513,7 +518,8 @@ YwDVP+QmNRzx72jtqAN/Kc3CvQ9nkgYhU65B95aX0xA=', ->method('newClient') ->willReturn($client); - $this->installer->downloadApp('testapp'); + $installer = $this->getInstaller(); + $installer->downloadApp('testapp'); } public function testDownloadAppSuccessful() { @@ -591,7 +597,8 @@ MPLX6f5V9tCJtlH6ztmEcDROfvuVc0U3rEhqx2hphoyo+MZrPFpdcJL8KkIdMKbY ->method('newClient') ->willReturn($client); - $this->installer->downloadApp('testapp'); + $installer = $this->getInstaller(); + $installer->downloadApp('testapp'); $this->assertTrue(file_exists(__DIR__ . '/../../apps/testapp/appinfo/info.xml')); $this->assertEquals('0.9', \OC_App::getAppVersionByPath(__DIR__ . '/../../apps/testapp/')); @@ -679,7 +686,8 @@ JXhrdaWDZ8fzpUjugrtC3qslsqL0dzgU37anS3HwrT8=', $this->assertTrue(file_exists(__DIR__ . '/../../apps/testapp/appinfo/info.xml')); $this->assertEquals('0.9', \OC_App::getAppVersionByPath(__DIR__ . '/../../apps/testapp/')); - $this->installer->downloadApp('testapp'); + $installer = $this->getInstaller(); + $installer->downloadApp('testapp'); $this->assertTrue(file_exists(__DIR__ . '/../../apps/testapp/appinfo/info.xml')); $this->assertEquals('0.8', \OC_App::getAppVersionByPath(__DIR__ . '/../../apps/testapp/')); } |