From 288d4de218dec81035ffa06d2326ca15d9598e4e Mon Sep 17 00:00:00 2001 From: fulmeek <36341513+fulmeek@users.noreply.github.com> Date: Sat, 5 Jan 2019 12:29:26 +0100 Subject: [PATCH] bridges: Fix bridges to pass unit test (#984) * [DealabsBridge] fixed parameters * [DemonoidBridge] added parameter context names * [DevToBridge] fixed parameters * [ExtremeDownloadBridge] fixed parameters * [GithubIssueBridge] fixed parameters * [InstagramBridge] added parameter context names * [MydealsBridge] fixed parameters * [OnVaSortirBridge] fixed parameters * [ThingyverseBridge] fixed parameters * [HotUKDealsBridge] fixed parameters * [FeedExpanderExample] added proper URI * [GQMagazineBridge] fixed parameters and getDomain() * [MozillaSecurityBridge] fixed filename References #980 --- bridges/DealabsBridge.php | 14 +- bridges/DemonoidBridge.php | 125 +++++++++--------- bridges/DevToBridge.php | 3 +- bridges/ExtremeDownloadBridge.php | 2 +- bridges/FeedExpanderExampleBridge.php | 2 +- bridges/GQMagazineBridge.php | 18 ++- bridges/GithubIssueBridge.php | 2 +- bridges/HotUKDealsBridge.php | 14 +- bridges/InstagramBridge.php | 6 +- ...Security.php => MozillaSecurityBridge.php} | 0 bridges/MydealsBridge.php | 14 +- bridges/OnVaSortirBridge.php | 3 +- bridges/ThingiverseBridge.php | 3 +- 13 files changed, 102 insertions(+), 104 deletions(-) rename bridges/{MozillaSecurity.php => MozillaSecurityBridge.php} (100%) diff --git a/bridges/DealabsBridge.php b/bridges/DealabsBridge.php index 873f5d01..89183edb 100644 --- a/bridges/DealabsBridge.php +++ b/bridges/DealabsBridge.php @@ -15,27 +15,25 @@ class DealabsBridge extends PepperBridgeAbstract { 'hide_expired' => array( 'name' => 'Masquer les éléments expirés', 'type' => 'checkbox', - 'required' => 'true' + 'required' => true ), 'hide_local' => array( 'name' => 'Masquer les deals locaux', 'type' => 'checkbox', 'title' => 'Masquer les deals en magasins physiques', - 'required' => 'true' + 'required' => true ), 'priceFrom' => array( 'name' => 'Prix minimum', 'type' => 'text', 'title' => 'Prix mnimum en euros', - 'required' => 'false', - 'defaultValue' => '' + 'required' => false ), 'priceTo' => array( 'name' => 'Prix maximum', 'type' => 'text', 'title' => 'Prix maximum en euros', - 'required' => 'false', - 'defaultValue' => '' + 'required' => false ), ), @@ -43,7 +41,7 @@ class DealabsBridge extends PepperBridgeAbstract { 'group' => array( 'name' => 'Groupe', 'type' => 'list', - 'required' => 'true', + 'required' => true, 'title' => 'Groupe dont il faut afficher les deals', 'values' => array( 'Abonnements internet' => 'abonnements-internet', @@ -959,7 +957,7 @@ class DealabsBridge extends PepperBridgeAbstract { 'order' => array( 'name' => 'Trier par', 'type' => 'list', - 'required' => 'true', + 'required' => true, 'title' => 'Ordre de tri des deals', 'values' => array( 'Du deal le plus Hot au moins Hot' => '', diff --git a/bridges/DemonoidBridge.php b/bridges/DemonoidBridge.php index bfbb785c..842b4214 100644 --- a/bridges/DemonoidBridge.php +++ b/bridges/DemonoidBridge.php @@ -6,72 +6,75 @@ class DemonoidBridge extends BridgeAbstract { const URI = 'https://www.demonoid.pw/'; const DESCRIPTION = 'Returns results from search'; - const PARAMETERS = array(array( - 'q' => array( - 'name' => 'keywords', - 'exampleValue' => 'keyword1 keyword2…', - 'required' => true, + const PARAMETERS = array( + 'Keywords' => array( + 'q' => array( + 'name' => 'keywords', + 'exampleValue' => 'keyword1 keyword2…', + 'required' => true, + ), + 'category' => array( + 'name' => 'Category', + 'type' => 'list', + 'values' => array( + 'All' => 0, + 'Movies' => 1, + 'Music' => 2, + 'TV' => 3, + 'Games' => 4, + 'Applications' => 5, + 'Pictures' => 8, + 'Anime' => 9, + 'Comics' => 10, + 'Books' => 11, + 'Audiobooks' => 17 + ) + ) ), - 'category' => array( - 'name' => 'Category', - 'type' => 'list', - 'values' => array( - 'All' => 0, - 'Movies' => 1, - 'Music' => 2, - 'TV' => 3, - 'Games' => 4, - 'Applications' => 5, - 'Pictures' => 8, - 'Anime' => 9, - 'Comics' => 10, - 'Books' => 11, - 'Audiobooks' => 17 + 'Category Only' => array( + 'catOnly' => array( + 'name' => 'Category', + 'type' => 'list', + 'values' => array( + 'All' => 0, + 'Movies' => 1, + 'Music' => 2, + 'TV' => 3, + 'Games' => 4, + 'Applications' => 5, + 'Pictures' => 8, + 'Anime' => 9, + 'Comics' => 10, + 'Books' => 11, + 'Audiobooks' => 17 + ) ) - ) - ), array( - 'catOnly' => array( - 'name' => 'Category', - 'type' => 'list', - 'values' => array( - 'All' => 0, - 'Movies' => 1, - 'Music' => 2, - 'TV' => 3, - 'Games' => 4, - 'Applications' => 5, - 'Pictures' => 8, - 'Anime' => 9, - 'Comics' => 10, - 'Books' => 11, - 'Audiobooks' => 17 - ) - ) - ), array( - 'userid' => array( - 'name' => 'user id', - 'exampleValue' => '00000', - 'required' => true, - 'type' => 'number' ), - 'category' => array( - 'name' => 'Category', - 'type' => 'list', - 'values' => array( - 'All' => 0, - 'Movies' => 1, - 'Music' => 2, - 'TV' => 3, - 'Games' => 4, - 'Applications' => 5, - 'Pictures' => 8, - 'Anime' => 9, - 'Comics' => 10, - 'Books' => 11, - 'Audiobooks' => 17 + 'User ID' => array( + 'userid' => array( + 'name' => 'user id', + 'exampleValue' => '00000', + 'required' => true, + 'type' => 'number' + ), + 'category' => array( + 'name' => 'Category', + 'type' => 'list', + 'values' => array( + 'All' => 0, + 'Movies' => 1, + 'Music' => 2, + 'TV' => 3, + 'Games' => 4, + 'Applications' => 5, + 'Pictures' => 8, + 'Anime' => 9, + 'Comics' => 10, + 'Books' => 11, + 'Audiobooks' => 17 + ) ) ) - ) ); public function collectData() { diff --git a/bridges/DevToBridge.php b/bridges/DevToBridge.php index 26552c69..868ac976 100644 --- a/bridges/DevToBridge.php +++ b/bridges/DevToBridge.php @@ -22,8 +22,7 @@ class DevToBridge extends BridgeAbstract { 'name' => 'Full article', 'type' => 'checkbox', 'required' => false, - 'title' => 'Enable to receive the full article for each item', - 'defaultValue' => false + 'title' => 'Enable to receive the full article for each item' ) ) ); diff --git a/bridges/ExtremeDownloadBridge.php b/bridges/ExtremeDownloadBridge.php index 3a4f60d6..52729971 100644 --- a/bridges/ExtremeDownloadBridge.php +++ b/bridges/ExtremeDownloadBridge.php @@ -15,7 +15,7 @@ class ExtremeDownloadBridge extends BridgeAbstract { 'filter' => array( 'name' => 'Type de contenu', 'type' => 'list', - 'required' => 'true', + 'required' => true, 'title' => 'Type de contenu à suivre : Téléchargement, Streaming ou les deux', 'values' => array( 'Streaming et Téléchargement' => 'both', diff --git a/bridges/FeedExpanderExampleBridge.php b/bridges/FeedExpanderExampleBridge.php index 9d2f1788..537a6352 100644 --- a/bridges/FeedExpanderExampleBridge.php +++ b/bridges/FeedExpanderExampleBridge.php @@ -3,7 +3,7 @@ class FeedExpanderExampleBridge extends FeedExpander { const MAINTAINER = 'logmanoriginal'; const NAME = 'FeedExpander Example'; - const URI = '#'; + const URI = 'http://github.com/RSS-Bridge/rss-bridge/'; const DESCRIPTION = 'Example bridge to test FeedExpander'; const PARAMETERS = array( diff --git a/bridges/GQMagazineBridge.php b/bridges/GQMagazineBridge.php index fa36c4e7..961b3a09 100644 --- a/bridges/GQMagazineBridge.php +++ b/bridges/GQMagazineBridge.php @@ -9,7 +9,6 @@ */ class GQMagazineBridge extends BridgeAbstract { - const MAINTAINER = 'Riduidel'; const NAME = 'GQMagazine'; @@ -20,18 +19,18 @@ class GQMagazineBridge extends BridgeAbstract const CACHE_TIMEOUT = 7200; // 2h const DESCRIPTION = 'GQMagazine section extractor bridge. This bridge allows you get only a specific section.'; + const DEFAULT_DOMAIN = 'www.gqmagazine.fr'; + const PARAMETERS = array( array( 'domain' => array( 'name' => 'Domain to use', 'required' => true, - 'values' => array( - 'www.gqmagazine.fr' => 'www.gqmagazine.fr' - ), - 'defaultValue' => 'www.gqmagazine.fr' + 'defaultValue' => self::DEFAULT_DOMAIN ), 'page' => array( 'name' => 'Initial page to load', - 'required' => true + 'required' => true, + 'exampleValue' => 'sexe/news' ), )); @@ -42,7 +41,12 @@ class GQMagazineBridge extends BridgeAbstract ); private function getDomain() { - return $this->getInput('domain'); + $domain = $this->getInput('domain'); + if (empty($domain)) + $domain = self::DEFAULT_DOMAIN; + if (strpos($domain, '://') === false) + $domain = 'https://' . $domain; + return $domain; } public function getURI() diff --git a/bridges/GithubIssueBridge.php b/bridges/GithubIssueBridge.php index c193610c..91dd45ec 100644 --- a/bridges/GithubIssueBridge.php +++ b/bridges/GithubIssueBridge.php @@ -28,7 +28,7 @@ class GithubIssueBridge extends BridgeAbstract { 'i' => array( 'name' => 'Issue number', 'type' => 'number', - 'required' => 'true' + 'required' => true ) ) ); diff --git a/bridges/HotUKDealsBridge.php b/bridges/HotUKDealsBridge.php index a7eebf61..8c1b3bd1 100644 --- a/bridges/HotUKDealsBridge.php +++ b/bridges/HotUKDealsBridge.php @@ -17,27 +17,25 @@ class HotUKDealsBridge extends PepperBridgeAbstract { 'hide_expired' => array( 'name' => 'Hide expired deals', 'type' => 'checkbox', - 'required' => 'true' + 'required' => true ), 'hide_local' => array( 'name' => 'Hide local deals', 'type' => 'checkbox', 'title' => 'Hide deals in physical store', - 'required' => 'true' + 'required' => true ), 'priceFrom' => array( 'name' => 'Minimal Price', 'type' => 'text', 'title' => 'Minmal Price in Pounds', - 'required' => 'false', - 'defaultValue' => '' + 'required' => false ), 'priceTo' => array( 'name' => 'Maximum Price', 'type' => 'text', 'title' => 'Maximum Price in Pounds', - 'required' => 'false', - 'defaultValue' => '' + 'required' => false ), ), @@ -45,7 +43,7 @@ class HotUKDealsBridge extends PepperBridgeAbstract { 'group' => array( 'name' => 'Group', 'type' => 'list', - 'required' => 'true', + 'required' => true, 'title' => 'Group whose deals must be displayed', 'values' => array( '2DS' => '2ds', @@ -1319,7 +1317,7 @@ class HotUKDealsBridge extends PepperBridgeAbstract { 'order' => array( 'name' => 'Order by', 'type' => 'list', - 'required' => 'true', + 'required' => true, 'title' => 'Sort order of deals', 'values' => array( 'From the most to the least hot deal' => '-hot', diff --git a/bridges/InstagramBridge.php b/bridges/InstagramBridge.php index fed8d64c..7a5f2b60 100644 --- a/bridges/InstagramBridge.php +++ b/bridges/InstagramBridge.php @@ -7,19 +7,19 @@ class InstagramBridge extends BridgeAbstract { const DESCRIPTION = 'Returns the newest images'; const PARAMETERS = array( - array( + 'Username' => array( 'u' => array( 'name' => 'username', 'required' => true ) ), - array( + 'Hashtag' => array( 'h' => array( 'name' => 'hashtag', 'required' => true ) ), - array( + 'Location' => array( 'l' => array( 'name' => 'location', 'required' => true diff --git a/bridges/MozillaSecurity.php b/bridges/MozillaSecurityBridge.php similarity index 100% rename from bridges/MozillaSecurity.php rename to bridges/MozillaSecurityBridge.php diff --git a/bridges/MydealsBridge.php b/bridges/MydealsBridge.php index 163cf62e..aa5bb489 100644 --- a/bridges/MydealsBridge.php +++ b/bridges/MydealsBridge.php @@ -17,27 +17,25 @@ class MydealsBridge extends PepperBridgeAbstract { 'hide_expired' => array( 'name' => 'Abgelaufenes ausblenden', 'type' => 'checkbox', - 'required' => 'true' + 'required' => true ), 'hide_local' => array( 'name' => 'Lokales ausblenden', 'type' => 'checkbox', 'title' => 'Deals im physischen Geschäft ausblenden', - 'required' => 'true' + 'required' => true ), 'priceFrom' => array( 'name' => 'Minimaler Preis', 'type' => 'text', 'title' => 'Minmaler Preis in Euros', - 'required' => 'false', - 'defaultValue' => '' + 'required' => false ), 'priceTo' => array( 'name' => 'Maximaler Preis', 'type' => 'text', 'title' => 'maximaler Preis in Euro', - 'required' => 'false', - 'defaultValue' => '' + 'required' => false ), ), @@ -45,7 +43,7 @@ class MydealsBridge extends PepperBridgeAbstract { 'group' => array( 'name' => 'Gruppen', 'type' => 'list', - 'required' => 'true', + 'required' => true, 'title' => 'Gruppe, deren Deals angezeigt werden müssen', 'values' => array( 'Elektronik' => 'elektronik', @@ -68,7 +66,7 @@ class MydealsBridge extends PepperBridgeAbstract { 'order' => array( 'name' => 'sortieren nach', 'type' => 'list', - 'required' => 'true', + 'required' => true, 'title' => 'Sortierung der deals', 'values' => array( 'Vom heißesten zum kältesten Deal' => '', diff --git a/bridges/OnVaSortirBridge.php b/bridges/OnVaSortirBridge.php index aad44fb8..ee6baf19 100644 --- a/bridges/OnVaSortirBridge.php +++ b/bridges/OnVaSortirBridge.php @@ -111,8 +111,7 @@ class OnVaSortirBridge extends FeedExpander { 'Valence' => 'valence', 'Vannes' => 'vannes', 'Zurich' => 'zurich', - ), - 'defaultValue' => '' + ) ) ) ); diff --git a/bridges/ThingiverseBridge.php b/bridges/ThingiverseBridge.php index 4c41fb6b..2412f79e 100644 --- a/bridges/ThingiverseBridge.php +++ b/bridges/ThingiverseBridge.php @@ -112,8 +112,7 @@ class ThingiverseBridge extends BridgeAbstract { '3D Printer Parts' => '128', '3D Printers' => '126', '3D Printing Tests' => '129', - ), - 'defaultValue' => '' + ) ), 'showimage' => array( 'name' => 'Show image in content',