public function testListCategoriesNotCachedWithAppStore() { $expected = [['id' => 0, 'ident' => 'enabled', 'displayName' => 'Enabled'], ['id' => 1, 'ident' => 'disabled', 'displayName' => 'Not enabled'], ['id' => 0, 'ident' => 'tools', 'displayName' => 'Tools'], ['id' => 1, 'ident' => 'games', 'displayName' => 'Games'], ['id' => 2, 'ident' => 'productivity', 'displayName' => 'Productivity'], ['id' => 3, 'ident' => 'multimedia', 'displayName' => 'Multimedia']]; $this->cache->expects($this->once())->method('get')->with('listCategories')->will($this->returnValue(null)); $this->cache->expects($this->once())->method('set')->with('listCategories', $expected, 3600); $this->ocsClient->expects($this->once())->method('isAppStoreEnabled')->will($this->returnValue(true)); $this->ocsClient->expects($this->once())->method('getCategories')->will($this->returnValue(['ownCloud Tools', 'Games', 'ownCloud Productivity', 'Multimedia'])); $this->assertSame($expected, $this->appSettingsController->listCategories()); }
public function testListCategoriesNotCachedWithAppStore() { $expected = [ [ 'id' => 0, 'displayName' => 'Enabled', ], [ 'id' => 1, 'displayName' => 'Not enabled', ], [ 'id' => 0, 'displayName' => 'Tools', ], [ 'id' => 1, 'displayName' => 'Awesome Games', ], [ 'id' => 2, 'displayName' => 'PIM', ], [ 'id' => 3, 'displayName' => 'Papershop', ], ]; $this->cache ->expects($this->once()) ->method('get') ->with('listCategories') ->will($this->returnValue(null)); $this->cache ->expects($this->once()) ->method('set') ->with('listCategories', $expected, 3600); $this->ocsClient ->expects($this->once()) ->method('isAppStoreEnabled') ->will($this->returnValue(true)); $this->ocsClient ->expects($this->once()) ->method('getCategories') ->will($this->returnValue( [ 'ownCloud Tools', 'Awesome Games', 'ownCloud PIM', 'Papershop', ] )); $this->assertSame($expected, $this->appSettingsController->listCategories()); }
public function testGetAppsDisabled() { $this->ocsClient->expects($this->any())->method($this->anything())->will($this->returnValue(null)); $_GET['filter'] = 'disabled'; $result = $this->api->getApps(['filter' => 'disabled']); $this->assertTrue($result->succeeded()); $data = $result->getData(); $apps = \OC_App::listAllApps(false, true, $this->ocsClient); $list = array(); foreach ($apps as $app) { $list[] = $app['id']; } $disabled = array_diff($list, \OC_App::getEnabledApps()); $this->assertEquals(count($disabled), count($data['apps'])); }