diff options
-rw-r--r-- | appinfo/application.php | 41 | ||||
-rw-r--r-- | config/appconfig.php | 46 | ||||
-rw-r--r-- | templates/part.feed.unread.php | 2 | ||||
-rw-r--r-- | templates/part.listfeed.php | 2 | ||||
-rw-r--r-- | templates/part.listfolder.php | 2 | ||||
-rw-r--r-- | tests/classloader.php | 2 | ||||
-rw-r--r-- | tests/unit/config/AppConfigTest.php | 33 | ||||
-rw-r--r-- | tests/unit/db/FeedMapperTest.php | 2 | ||||
-rw-r--r-- | tests/unit/db/FolderMapperTest.php | 30 | ||||
-rw-r--r-- | tests/unit/db/ItemMapperTest.php | 2 | ||||
-rw-r--r-- | tests/unit/db/postgres/ItemMapperTest.php | 6 |
11 files changed, 56 insertions, 112 deletions
diff --git a/appinfo/application.php b/appinfo/application.php index e9e9c8bde..a353884cb 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -74,7 +74,7 @@ class Application extends App { */ $container->registerService('PageController', function($c) { return new PageController( - $c->query('AppName'), + $c->query('AppName'), $c->query('Request'), $c->query('CoreConfig'), $c->query('L10N'), @@ -84,7 +84,7 @@ class Application extends App { $container->registerService('FolderController', function($c) { return new FolderController( - $c->query('AppName'), + $c->query('AppName'), $c->query('Request'), $c->query('FolderService'), $c->query('FeedService'), @@ -95,7 +95,7 @@ class Application extends App { $container->registerService('FeedController', function($c) { return new FeedController( - $c->query('AppName'), + $c->query('AppName'), $c->query('Request'), $c->query('FolderService'), $c->query('FeedService'), @@ -107,7 +107,7 @@ class Application extends App { $container->registerService('ItemController', function($c) { return new ItemController( - $c->query('AppName'), + $c->query('AppName'), $c->query('Request'), $c->query('FeedService'), $c->query('ItemService'), @@ -118,7 +118,7 @@ class Application extends App { $container->registerService('ExportController', function($c) { return new ExportController( - $c->query('AppName'), + $c->query('AppName'), $c->query('Request'), $c->query('FolderService'), $c->query('FeedService'), @@ -130,8 +130,8 @@ class Application extends App { $container->registerService('UtilityApiController', function($c) { return new UtilityApiController( - $c->query('AppName'), - $c->query('Request'), + $c->query('AppName'), + $c->query('Request'), $c->query('Updater'), $c->query('CoreConfig') ); @@ -139,7 +139,7 @@ class Application extends App { $container->registerService('FolderApiController', function($c) { return new FolderApiController( - $c->query('AppName'), + $c->query('AppName'), $c->query('Request'), $c->query('FolderService'), $c->query('ItemService'), @@ -149,7 +149,7 @@ class Application extends App { $container->registerService('FeedApiController', function($c) { return new FeedApiController( - $c->query('AppName'), + $c->query('AppName'), $c->query('Request'), $c->query('FeedService'), $c->query('ItemService'), @@ -161,7 +161,7 @@ class Application extends App { $container->registerService('ItemApiController', function($c) { return new ItemApiController( - $c->query('AppName'), + $c->query('AppName'), $c->query('Request'), $c->query('ItemService'), $c->query('UserId') @@ -211,7 +211,7 @@ class Application extends App { */ $container->registerService('MapperFactory', function($c) { return new MapperFactory( - $c->query('DatabaseType'), + $c->query('DatabaseType'), $c->query('Db') ); }); @@ -239,16 +239,6 @@ class Application extends App { * App config parser */ $container->registerService('AppConfig', function($c) { - // not performant but well :/ - // $config = $c->query('ServerContainer')->getAppConfig(); oc7 only - $installedApps = \OC_Appconfig::getApps(); - $apps = []; - foreach($installedApps as $app) { - $apps[] = [ - $app => \OC_Appconfig::getValue($app, 'installed_version', '0') - ]; - } - // order extensions in name => version $loadedExtensions = get_loaded_extensions(); $extensions = []; @@ -262,7 +252,6 @@ class Application extends App { $c->query('ServerContainer')->getURLGenerator(), phpversion(), implode('.', Util::getVersion()), - $apps, $extensions, $c->query('DatabaseType') ); @@ -270,7 +259,7 @@ class Application extends App { /** * Core - */ + */ $container->registerService('L10N', function($c) { return $c->query('ServerContainer')->getL10N($c->query('AppName')); }); @@ -314,7 +303,7 @@ class Application extends App { $container->registerService('Config', function($c) { $config = new Config( - $c->query('ConfigView'), + $c->query('ConfigView'), $c->query('Logger'), $c->query('LoggerParameters') ); @@ -345,7 +334,7 @@ class Application extends App { $config->set('Cache.SerializerPath', $directory); $config->set('HTML.SafeIframe', true); $config->set('URI.SafeIframeRegexp', - '%^(?:https?:)?//(' . + '%^(?:https?:)?//(' . 'www.youtube(?:-nocookie)?.com/embed/|' . 'player.vimeo.com/video/)%'); //allow YouTube and Vimeo return new \HTMLPurifier($config); @@ -358,7 +347,7 @@ class Application extends App { $xpathEnhancerConfig = file_get_contents( __DIR__ . '/../articleenhancer/xpathenhancers.json' ); - + foreach(json_decode($xpathEnhancerConfig, true) as $feed => $config) { $articleEnhancer = new XPathArticleEnhancer( $c->query('SimplePieAPIFactory'), diff --git a/config/appconfig.php b/config/appconfig.php index e2cc01aec..5292d35a7 100644 --- a/config/appconfig.php +++ b/config/appconfig.php @@ -28,7 +28,6 @@ class AppConfig { private $urlGenerator; private $phpVersion; private $ownCloudVersion; - private $installedApps; private $installedExtensions; private $databaseType; private $l10n; @@ -43,7 +42,6 @@ class AppConfig { IURLGenerator $urlGenerator, $phpVersion, $ownCloudVersion, - $installedApps, $installedExtensions, $databaseType) { $this->navigationManager = $navigationManager; @@ -51,7 +49,6 @@ class AppConfig { $this->urlGenerator = $urlGenerator; $this->ownCloudVersion = $ownCloudVersion; $this->phpVersion = $phpVersion; - $this->installedApps = $installedApps; $this->installedExtensions = $installedExtensions; $this->databaseType = $databaseType; $this->config = []; @@ -85,7 +82,7 @@ class AppConfig { foreach($defaults as $key => $value) { if(!array_key_exists($key, $nav)) { $nav[$key] = $value; - } + } } } } @@ -99,7 +96,7 @@ class AppConfig { if($key !== null) { return $this->config[$key]; } else { - return $this->config; + return $this->config; } } @@ -111,7 +108,7 @@ class AppConfig { // if key is missing, don't create a navigation if(array_key_exists('navigation', $this->config)) { $nav =& $this->config['navigation']; - + $navConfig = [ 'id' => $nav['id'], 'order' => $nav['order'] @@ -119,7 +116,7 @@ class AppConfig { $navConfig['name'] = $this->l10n->t($nav['name']); $navConfig['href'] = $this->urlGenerator->linkToRoute($nav['route']); - $navConfig['icon'] = $this->urlGenerator->imagePath($nav['id'], + $navConfig['icon'] = $this->urlGenerator->imagePath($nav['id'], $nav['icon']); $this->navigationManager->add($navConfig); @@ -132,7 +129,7 @@ class AppConfig { * Registers all jobs in the config */ public function registerBackgroundJobs() { - // FIXME: this is temporarily static because core jobs are not public + // FIXME: this is temporarily static because core jobs are not public // yet, therefore legacy code foreach ($this->config['jobs'] as $job) { Backgroundjob::addRegularTask($job, 'run'); @@ -144,7 +141,7 @@ class AppConfig { * Registers all hooks in the config */ public function registerHooks() { - // FIXME: this is temporarily static because core emitters are not future + // FIXME: this is temporarily static because core emitters are not future // proof, therefore legacy code in here foreach ($this->config['hooks'] as $listen => $react) { $listener = explode('::', $listen); @@ -168,14 +165,14 @@ class AppConfig { if(array_key_exists('databases', $this->config)) { if(!in_array($this->databaseType, $this->config['databases'])) { $msg .= 'Database ' . $this->databaseType . ' not supported.' . - 'App is only compatible with ' . + 'App is only compatible with ' . implode(', ', $this->config['databases']); } } - + // test dependencies if(array_key_exists('dependencies', $this->config)) { - + $deps = $this->config['dependencies']; if(array_key_exists('php', $deps)) { @@ -184,25 +181,14 @@ class AppConfig { } if(array_key_exists('owncloud', $deps)) { - $msg .= $this->requireVersion($this->ownCloudVersion, + $msg .= $this->requireVersion($this->ownCloudVersion, $deps['owncloud'], 'ownCloud'); } - if(array_key_exists('apps', $deps)) { - foreach ($deps['apps'] as $app => $versions) { - if(array_key_exists($app, $this->installedApps)) { - $msg .= $this->requireVersion($this->installedApps[$app], - $versions, 'App ' . $app); - } else { - $msg .= 'ownCloud app ' . $app . ' required but not installed'; - } - } - } - if(array_key_exists('libs', $deps)) { foreach ($deps['libs'] as $lib => $versions) { if(array_key_exists($lib, $this->installedExtensions)) { - $msg .= $this->requireVersion($this->installedExtensions[$lib], + $msg .= $this->requireVersion($this->installedExtensions[$lib], $versions, 'PHP extension ' . $lib); } else { $msg .= 'PHP extension ' . $lib . ' required but not installed'; @@ -220,9 +206,9 @@ class AppConfig { /** * Compares a version with a version requirement string * @param string $actual the actual version that is there - * @param string $required a version requirement in the form of + * @param string $required a version requirement in the form of * <=5.3,>4.5 versions are separated with a comma - * @param string $versionType a description of the string that is prepended + * @param string $versionType a description of the string that is prepended * to the error message * @return string an error message if the version is not met, * empty string if ok @@ -236,8 +222,8 @@ class AppConfig { continue; } if(!version_compare($actual, $version['version'], $version['operator'])) { - return $versionType . ' Version not satisfied: ' . $version['operator'] . - $version['version'] . ' required but found ' . $actual . '\n'; + return $versionType . ' Version not satisfied: ' . $version['operator'] . + $version['version'] . ' required but found ' . $actual . '\n'; } } @@ -247,7 +233,7 @@ class AppConfig { /** * Versions can be separated by a comma so split them - * @param string $versions a version requirement in the form of + * @param string $versions a version requirement in the form of * <=5.3,>4.5 versions are separated with a comma * @return array of arrays with key=version value=operator */ diff --git a/templates/part.feed.unread.php b/templates/part.feed.unread.php index 275c36dd6..979824d1c 100644 --- a/templates/part.feed.unread.php +++ b/templates/part.feed.unread.php @@ -2,7 +2,7 @@ active: Navigation.isSubscriptionsActive(), unread: Navigation.getUnreadCount() > 0 }" - class="has-counter"> + class="has-counter has-menu"> <a class="icon-rss" ng-href="#/items/" ng-if="!Navigation.isShowAll()"> <?php p($l->t('Unread articles'))?> diff --git a/templates/part.listfeed.php b/templates/part.listfeed.php index f3e2695d5..e0d00d093 100644 --- a/templates/part.listfeed.php +++ b/templates/part.listfeed.php @@ -9,7 +9,7 @@ || Navigation.isFeedActive(feed.id) || !feed.id" data-id="{{ feed.id }}" - class="feed has-counter" + class="feed has-counter has-menu" news-draggable="{ stack: '> li', zIndex: 1000, diff --git a/templates/part.listfolder.php b/templates/part.listfolder.php index 91d2995ef..8f97dfa9d 100644 --- a/templates/part.listfolder.php +++ b/templates/part.listfolder.php @@ -11,7 +11,7 @@ || Navigation.isFolderActive(folder.id) || Navigation.subFeedActive(folder.id) || !folder.id" - class="folder has-counter" + class="folder has-counter has-menu" data-id="{{ folder.id }}" news-droppable> <button class="collapse" diff --git a/tests/classloader.php b/tests/classloader.php index 8fdd9704d..fc133eaf5 100644 --- a/tests/classloader.php +++ b/tests/classloader.php @@ -12,7 +12,7 @@ */ require_once __DIR__ . '/../3rdparty/simplepie/autoloader.php'; -require_once __DIR__ . '/../../../tests/lib/appframework/db/MapperTestUtility.php'; +require_once __DIR__ . '/../../../tests/lib/appframework/db/mappertestutility.php'; // to execute without owncloud, we need to create our own classloader spl_autoload_register(function ($className){ diff --git a/tests/unit/config/AppConfigTest.php b/tests/unit/config/AppConfigTest.php index 470442bc5..9053c6cbd 100644 --- a/tests/unit/config/AppConfigTest.php +++ b/tests/unit/config/AppConfigTest.php @@ -32,12 +32,11 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase { ->getMock(); $phpVersion = '5.3'; $ownCloudVersion = '6.0.3'; - $installedApps = ['contacts' => '5.3', 'calendar' => '2.3']; $installedExtensions = ['curl' => '4.3']; $databaseType = 'oracle'; $this->config = new AppConfig($this->nav, $this->l10n, - $this->url, $phpVersion, $ownCloudVersion, $installedApps, + $this->url, $phpVersion, $ownCloudVersion, $installedExtensions, $databaseType); } @@ -160,22 +159,6 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase { /** * @expectedException \OCA\News\Config\DependencyException */ - public function testAppVersion() { - $this->config->loadConfig([ - 'dependencies' => [ - 'apps' => [ - 'contacts' => '5.3', - 'calendar' => '>2.3' - ] - ] - ]); - $this->config->testDependencies(); - } - - - /** - * @expectedException \OCA\News\Config\DependencyException - */ public function testLibsVersion() { $this->config->loadConfig([ 'dependencies' => [ @@ -203,20 +186,6 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase { } - /** - * @expectedException \OCA\News\Config\DependencyException - */ - public function testAppsExistence() { - $this->config->loadConfig([ - 'dependencies' => [ - 'apps' => [ - 'news' => '>=4.3,<=4.3' - ] - ] - ]); - $this->config->testDependencies(); - } - /** * @expectedException \OCA\News\Config\DependencyException diff --git a/tests/unit/db/FeedMapperTest.php b/tests/unit/db/FeedMapperTest.php index 83dcc40ef..93137d8d4 100644 --- a/tests/unit/db/FeedMapperTest.php +++ b/tests/unit/db/FeedMapperTest.php @@ -14,7 +14,7 @@ namespace OCA\News\Db; -class FeedMapperTest extends \OCP\AppFramework\Db\MapperTestUtility { +class FeedMapperTest extends \Test\AppFramework\Db\MapperTestUtility { private $mapper; private $feeds; diff --git a/tests/unit/db/FolderMapperTest.php b/tests/unit/db/FolderMapperTest.php index b9196ef6b..6a2e94588 100644 --- a/tests/unit/db/FolderMapperTest.php +++ b/tests/unit/db/FolderMapperTest.php @@ -14,12 +14,12 @@ namespace OCA\News\Db; -class FolderMapperTest extends \OCP\AppFramework\Db\MapperTestUtility { +class FolderMapperTest extends \Test\AppFramework\Db\MapperTestUtility { private $folderMapper; private $folders; private $user; - + protected function setUp(){ parent::setUp(); @@ -45,12 +45,12 @@ class FolderMapperTest extends \OCP\AppFramework\Db\MapperTestUtility { $sql = 'SELECT * FROM `*PREFIX*news_folders` ' . 'WHERE `id` = ? ' . 'AND `user_id` = ?'; - + $this->setMapperResult($sql, [$id, $userId], $rows); - + $result = $this->folderMapper->find($id, $userId); $this->assertEquals($this->folders[0], $result); - + } @@ -60,13 +60,13 @@ class FolderMapperTest extends \OCP\AppFramework\Db\MapperTestUtility { $sql = 'SELECT * FROM `*PREFIX*news_folders` ' . 'WHERE `id` = ? ' . 'AND `user_id` = ?'; - + $this->setMapperResult($sql, [$id, $userId]); - + $this->setExpectedException('\OCP\AppFramework\Db\DoesNotExistException'); - $this->folderMapper->find($id, $userId); + $this->folderMapper->find($id, $userId); } - + public function testFindMoreThanOneResultFound(){ $userId = 'john'; @@ -75,9 +75,9 @@ class FolderMapperTest extends \OCP\AppFramework\Db\MapperTestUtility { $sql = 'SELECT * FROM `*PREFIX*news_folders` ' . 'WHERE `id` = ? ' . 'AND `user_id` = ?'; - + $this->setMapperResult($sql, [$id, $userId], $rows); - + $this->setExpectedException('\OCP\AppFramework\Db\MultipleObjectsReturnedException'); $this->folderMapper->find($id, $userId); } @@ -90,9 +90,9 @@ class FolderMapperTest extends \OCP\AppFramework\Db\MapperTestUtility { $sql = 'SELECT * FROM `*PREFIX*news_folders` ' . 'WHERE `user_id` = ? ' . 'AND `deleted_at` = 0'; - + $this->setMapperResult($sql, [$userId], $rows); - + $result = $this->folderMapper->findAllFromUser($userId); $this->assertEquals($this->folders, $result); } @@ -105,9 +105,9 @@ class FolderMapperTest extends \OCP\AppFramework\Db\MapperTestUtility { $sql = 'SELECT * FROM `*PREFIX*news_folders` ' . 'WHERE `name` = ? ' . 'AND `user_id` = ?'; - + $this->setMapperResult($sql, [$folderName, $userId], $rows); - + $result = $this->folderMapper->findByName($folderName, $userId); $this->assertEquals($this->folders, $result); } diff --git a/tests/unit/db/ItemMapperTest.php b/tests/unit/db/ItemMapperTest.php index b9feba977..6b5082d9b 100644 --- a/tests/unit/db/ItemMapperTest.php +++ b/tests/unit/db/ItemMapperTest.php @@ -14,7 +14,7 @@ namespace OCA\News\Db; -class ItemMapperTest extends \OCP\AppFramework\Db\MapperTestUtility { +class ItemMapperTest extends \Test\AppFramework\Db\MapperTestUtility { private $mapper; private $items; diff --git a/tests/unit/db/postgres/ItemMapperTest.php b/tests/unit/db/postgres/ItemMapperTest.php index d7c684c14..528f6003a 100644 --- a/tests/unit/db/postgres/ItemMapperTest.php +++ b/tests/unit/db/postgres/ItemMapperTest.php @@ -17,7 +17,7 @@ use \OCA\News\Db\Item; use \OCA\News\Db\StatusFlag; -class ItemMapperTest extends \OCP\AppFramework\Db\MapperTestUtility { +class ItemMapperTest extends \Test\AppFramework\Db\MapperTestUtility { private $mapper; private $items; @@ -65,7 +65,7 @@ class ItemMapperTest extends \OCP\AppFramework\Db\MapperTestUtility { public function testDeleteReadOlderThanThresholdDoesNotDeleteBelowThreshold(){ $status = StatusFlag::STARRED | StatusFlag::UNREAD; $sql = 'SELECT COUNT(*) - `feeds`.`articles_per_update` AS `size`, ' . - '`items`.`feed_id` AS `feed_id` ' . + '`items`.`feed_id` AS `feed_id` ' . 'FROM `*PREFIX*news_items` `items` ' . 'JOIN `*PREFIX*news_feeds` `feeds` ' . 'ON `feeds`.`id` = `items`.`feed_id` ' . @@ -89,7 +89,7 @@ class ItemMapperTest extends \OCP\AppFramework\Db\MapperTestUtility { $status = StatusFlag::STARRED | StatusFlag::UNREAD; $sql1 = 'SELECT COUNT(*) - `feeds`.`articles_per_update` AS `size`, ' . - '`items`.`feed_id` AS `feed_id` ' . + '`items`.`feed_id` AS `feed_id` ' . 'FROM `*PREFIX*news_items` `items` ' . 'JOIN `*PREFIX*news_feeds` `feeds` ' . 'ON `feeds`.`id` = `items`.`feed_id` ' . |