fix unit tests

This commit is contained in:
Morris Jobke 2015-11-23 13:13:26 +01:00
parent 1189528e1f
commit bc69cb2de3
2 changed files with 13 additions and 4 deletions

View File

@ -306,6 +306,7 @@ class Test_App extends \Test\TestCase {
'app3', 'app3',
'appforgroup1', 'appforgroup1',
'appforgroup12', 'appforgroup12',
'dav',
), ),
false false
), ),
@ -318,6 +319,7 @@ class Test_App extends \Test\TestCase {
'app3', 'app3',
'appforgroup12', 'appforgroup12',
'appforgroup2', 'appforgroup2',
'dav',
), ),
false false
), ),
@ -331,6 +333,7 @@ class Test_App extends \Test\TestCase {
'appforgroup1', 'appforgroup1',
'appforgroup12', 'appforgroup12',
'appforgroup2', 'appforgroup2',
'dav',
), ),
false false
), ),
@ -344,6 +347,7 @@ class Test_App extends \Test\TestCase {
'appforgroup1', 'appforgroup1',
'appforgroup12', 'appforgroup12',
'appforgroup2', 'appforgroup2',
'dav',
), ),
false, false,
), ),
@ -357,6 +361,7 @@ class Test_App extends \Test\TestCase {
'appforgroup1', 'appforgroup1',
'appforgroup12', 'appforgroup12',
'appforgroup2', 'appforgroup2',
'dav',
), ),
true, true,
), ),
@ -434,11 +439,11 @@ class Test_App extends \Test\TestCase {
); );
$apps = \OC_App::getEnabledApps(true); $apps = \OC_App::getEnabledApps(true);
$this->assertEquals(array('files', 'app3'), $apps); $this->assertEquals(array('files', 'app3', 'dav'), $apps);
// mock should not be called again here // mock should not be called again here
$apps = \OC_App::getEnabledApps(false); $apps = \OC_App::getEnabledApps(false);
$this->assertEquals(array('files', 'app3'), $apps); $this->assertEquals(array('files', 'app3', 'dav'), $apps);
$this->restoreAppConfig(); $this->restoreAppConfig();
\OC_User::setUserId(null); \OC_User::setUserId(null);

View File

@ -188,7 +188,7 @@ class Manager extends \PHPUnit_Framework_TestCase {
$this->appConfig->setValue('test1', 'enabled', 'yes'); $this->appConfig->setValue('test1', 'enabled', 'yes');
$this->appConfig->setValue('test2', 'enabled', 'no'); $this->appConfig->setValue('test2', 'enabled', 'no');
$this->appConfig->setValue('test3', 'enabled', '["foo"]'); $this->appConfig->setValue('test3', 'enabled', '["foo"]');
$this->assertEquals(['test1', 'test3'], $this->manager->getInstalledApps()); $this->assertEquals(['dav', 'files', 'test1', 'test3'], $this->manager->getInstalledApps());
} }
public function testGetAppsForUser() { public function testGetAppsForUser() {
@ -202,7 +202,7 @@ class Manager extends \PHPUnit_Framework_TestCase {
$this->appConfig->setValue('test2', 'enabled', 'no'); $this->appConfig->setValue('test2', 'enabled', 'no');
$this->appConfig->setValue('test3', 'enabled', '["foo"]'); $this->appConfig->setValue('test3', 'enabled', '["foo"]');
$this->appConfig->setValue('test4', 'enabled', '["asd"]'); $this->appConfig->setValue('test4', 'enabled', '["asd"]');
$this->assertEquals(['test1', 'test3'], $this->manager->getEnabledAppsForUser($user)); $this->assertEquals(['dav', 'files', 'test1', 'test3'], $this->manager->getEnabledAppsForUser($user));
} }
public function testGetAppsNeedingUpgrade() { public function testGetAppsNeedingUpgrade() {
@ -212,6 +212,8 @@ class Manager extends \PHPUnit_Framework_TestCase {
->getMock(); ->getMock();
$appInfos = [ $appInfos = [
'dav' => ['id' => 'dav'],
'files' => ['id' => 'files'],
'test1' => ['id' => 'test1', 'version' => '1.0.1', 'requiremax' => '9.0.0'], 'test1' => ['id' => 'test1', 'version' => '1.0.1', 'requiremax' => '9.0.0'],
'test2' => ['id' => 'test2', 'version' => '1.0.0', 'requiremin' => '8.2.0'], 'test2' => ['id' => 'test2', 'version' => '1.0.0', 'requiremin' => '8.2.0'],
'test3' => ['id' => 'test3', 'version' => '1.2.4', 'requiremin' => '9.0.0'], 'test3' => ['id' => 'test3', 'version' => '1.2.4', 'requiremin' => '9.0.0'],
@ -250,6 +252,8 @@ class Manager extends \PHPUnit_Framework_TestCase {
->getMock(); ->getMock();
$appInfos = [ $appInfos = [
'dav' => ['id' => 'dav'],
'files' => ['id' => 'files'],
'test1' => ['id' => 'test1', 'version' => '1.0.1', 'requiremax' => '8.0.0'], 'test1' => ['id' => 'test1', 'version' => '1.0.1', 'requiremax' => '8.0.0'],
'test2' => ['id' => 'test2', 'version' => '1.0.0', 'requiremin' => '8.2.0'], 'test2' => ['id' => 'test2', 'version' => '1.0.0', 'requiremin' => '8.2.0'],
'test3' => ['id' => 'test3', 'version' => '1.2.4', 'requiremin' => '9.0.0'], 'test3' => ['id' => 'test3', 'version' => '1.2.4', 'requiremin' => '9.0.0'],