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()); }