From 4d9b3a4925de2e66a47ccd8f5d3d0d9032e3065a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 25 Nov 2013 17:10:43 +0100 Subject: [PATCH 01/70] Fix the redirect in case the database is not found. I also handle better the case were no file are actually found. Thanks to At Libitum. fix #116 --- base.php | 14 +++++++++++--- checkconfig.php | 2 ++ index.php | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/base.php b/base.php index 46b7a77..350ca34 100644 --- a/base.php +++ b/base.php @@ -889,15 +889,23 @@ abstract class Base public static function getDbFileName ($database = NULL) { return self::getDbDirectory ($database) .'metadata.db'; } + + private static function error () { + header("location: checkconfig.php?err=1"); + exit(); + } public static function getDb ($database = NULL) { global $config; if (is_null (self::$db)) { try { - self::$db = new PDO('sqlite:'. self::getDbFileName ($database)); + if (file_exists (self::getDbFileName ($database))) { + self::$db = new PDO('sqlite:'. self::getDbFileName ($database)); + } else { + self::error (); + } } catch (Exception $e) { - header("location: checkconfig.php?err=1"); - exit(); + self::error (); } } return self::$db; diff --git a/checkconfig.php b/checkconfig.php index 57f97a7..aac84bc 100644 --- a/checkconfig.php +++ b/checkconfig.php @@ -129,6 +129,7 @@ Please check } ?> +

Check if Calibre database file can be opened with PHP

@@ -182,6 +183,7 @@ Please check

+ diff --git a/index.php b/index.php index f9070d0..4dcea57 100644 --- a/index.php +++ b/index.php @@ -23,6 +23,10 @@ exit (); } + // Access the database ASAP to be sure it's readable, redirect if that's not the case. + // It has to be done before any header is sent. + $test = Base::getDb (); + header ("Content-Type:text/html;charset=utf-8"); $page = getURLParam ("page", Base::PAGE_INDEX); $query = getURLParam ("query"); From d12c7e9086fa6968106b9d2145c5e4702fbca353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 25 Nov 2013 21:16:34 +0100 Subject: [PATCH 02/70] Better test for missing metadata.db (also test if it's readable). re #116 --- base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base.php b/base.php index 350ca34..a2c31d7 100644 --- a/base.php +++ b/base.php @@ -899,7 +899,7 @@ abstract class Base global $config; if (is_null (self::$db)) { try { - if (file_exists (self::getDbFileName ($database))) { + if (is_readable (self::getDbFileName ($database))) { self::$db = new PDO('sqlite:'. self::getDbFileName ($database)); } else { self::error (); From 1051af4a61468a7621e99402f75ac6bd05566aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 25 Nov 2013 21:18:38 +0100 Subject: [PATCH 03/70] COPS now also work if Pushstate / ReplaceState is not available (IE9). Thanks to At Libitum. should fix #117 --- index.php | 4 +++- util.js | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 4dcea57..8bc5e93 100644 --- a/index.php +++ b/index.php @@ -101,7 +101,9 @@ updatePage (data [0]); cache.put (url, data [0]); - history.replaceState(url, "", window.location); + if (isPushStateEnabled) { + history.replaceState(url, "", window.location); + } handleLinks (); }); diff --git a/util.js b/util.js index 87c57f7..3c5b88d 100644 --- a/util.js +++ b/util.js @@ -281,7 +281,11 @@ updatePage = function (data) { ]); $('input[name=query]').bind('typeahead:selected', function(obj, datum) { - navigateTo (datum.navlink); + if (isPushStateEnabled) { + navigateTo (datum.navlink); + } else { + window.location = datum.navlink; + } }); }; From 990976986e501d77bc7c3e4e084aeb70c20c2ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 25 Nov 2013 21:35:02 +0100 Subject: [PATCH 04/70] Fix the redirect in case of multiple databases and if the failing database is not the first. re #116 --- index.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 8bc5e93..5fc64c7 100644 --- a/index.php +++ b/index.php @@ -23,16 +23,27 @@ exit (); } - // Access the database ASAP to be sure it's readable, redirect if that's not the case. - // It has to be done before any header is sent. - $test = Base::getDb (); - - header ("Content-Type:text/html;charset=utf-8"); $page = getURLParam ("page", Base::PAGE_INDEX); $query = getURLParam ("query"); $qid = getURLParam ("id"); $n = getURLParam ("n", "1"); $database = GetUrlParam (DB); + + + // Access the database ASAP to be sure it's readable, redirect if that's not the case. + // It has to be done before any header is sent. + if (is_array ($config['calibre_directory']) && is_null ($database)) { + $i = 0; + foreach (array_keys ($config['calibre_directory']) as $key) { + $test = Base::getDb ($i); + Base::clearDb (); + $i++; + } + } else { + $test = Base::getDb (); + } + + header ("Content-Type:text/html;charset=utf-8"); ?> From f7be2ce8932160651416dc4af47e4563e8a58bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 25 Nov 2013 21:40:54 +0100 Subject: [PATCH 05/70] Fix scrutinizer warnings. --- base.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/base.php b/base.php index a2c31d7..9cb5887 100644 --- a/base.php +++ b/base.php @@ -760,7 +760,6 @@ class PageCustomize extends Page { public function InitializeContent () { - global $config; $this->title = localize ("customize.title"); $this->entryArray = array (); @@ -896,7 +895,6 @@ abstract class Base } public static function getDb ($database = NULL) { - global $config; if (is_null (self::$db)) { try { if (is_readable (self::getDbFileName ($database))) { @@ -916,7 +914,6 @@ abstract class Base } public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) { - global $config; $totalResult = -1; if (is_null ($numberPerPage)) { From 6029355085f88c2893d3c47817d00648050e61e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Nov 2013 17:01:57 +0100 Subject: [PATCH 06/70] Add a new test. re #96 --- test/pageMultidatabaseTest.php | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/test/pageMultidatabaseTest.php b/test/pageMultidatabaseTest.php index 69d8df6..59511e2 100644 --- a/test/pageMultidatabaseTest.php +++ b/test/pageMultidatabaseTest.php @@ -34,4 +34,33 @@ class PageMultiDatabaseTest extends PHPUnit_Framework_TestCase $this->assertEquals ("1 book", $currentPage->entryArray [1]->content); $this->assertFalse ($currentPage->ContainsBook ()); } -} \ No newline at end of file + + public function testPageSearchXXX () + { + global $config; + $config['calibre_directory'] = array ("Some books" => dirname(__FILE__) . "/BaseWithSomeBooks/", + "One book" => dirname(__FILE__) . "/BaseWithOneBook/"); + $page = Base::PAGE_OPENSEARCH_QUERY; + $query = "art"; + $search = NULL; + $qid = NULL; + $n = "1"; + $database = NULL; + + $currentPage = Page::getPage ($page, $qid, $query, $n); + $currentPage->InitializeContent (); + + $this->assertEquals ("Search result for *art*", $currentPage->title); + $this->assertCount (2, $currentPage->entryArray); + $this->assertEquals ("Some books", $currentPage->entryArray [0]->title); + $this->assertEquals ("10 books", $currentPage->entryArray [0]->content); + $this->assertEquals ("One book", $currentPage->entryArray [1]->title); + $this->assertEquals ("1 book", $currentPage->entryArray [1]->content); + $this->assertFalse ($currentPage->ContainsBook ()); + } + + public static function tearDownAfterClass () { + Base::clearDb (); + } + +} From 39cf43cbc25f8e5ef2c0b421b6a451bbb635bbf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Nov 2013 17:17:22 +0100 Subject: [PATCH 07/70] Add some test of base functions. re #96 --- test/baseTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/baseTest.php b/test/baseTest.php index 7b2c21c..423930d 100644 --- a/test/baseTest.php +++ b/test/baseTest.php @@ -42,4 +42,19 @@ class BaseTest extends PHPUnit_Framework_TestCase $_SERVER['HTTP_ACCEPT_LANGUAGE'] = "en"; localize ("authors.title", -1, true); } + + public function testBaseFunction () { + global $config; + + $this->assertFalse (Base::isMultipleDatabaseEnabled ()); + $this->assertEquals (array ("" => dirname(__FILE__) . "/BaseWithSomeBooks/"), Base::getDbList ()); + + $config['calibre_directory'] = array ("Some books" => dirname(__FILE__) . "/BaseWithSomeBooks/", + "One book" => dirname(__FILE__) . "/BaseWithOneBook/"); + + $this->assertTrue (Base::isMultipleDatabaseEnabled ()); + $this->assertEquals ("Some books", Base::getDbName (0)); + $this->assertEquals ("One book", Base::getDbName (1)); + $this->assertEquals ($config['calibre_directory'], Base::getDbList ()); + } } \ No newline at end of file From fed84c71714e4a1f8d6692fc5544338c855993de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Nov 2013 17:39:17 +0100 Subject: [PATCH 08/70] Add a test for typeahead search with multiple databases. re #96 --- test/bookTest.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/bookTest.php b/test/bookTest.php index f23c053..05f3193 100644 --- a/test/bookTest.php +++ b/test/bookTest.php @@ -172,4 +172,30 @@ class BookTest extends PHPUnit_Framework_TestCase $_GET["search"] = NULL; } + public function testTypeaheadSearchMultiDatabase () + { + global $config; + $_GET["query"] = "art"; + $_GET["search"] = "1"; + $_GET["multi"] = "1"; + + $config['calibre_directory'] = array ("Some books" => dirname(__FILE__) . "/BaseWithSomeBooks/", + "One book" => dirname(__FILE__) . "/BaseWithOneBook/"); + + $array = getJson (); + + $this->assertCount (4, $array); + $this->assertEquals ("Some books", $array[0]["title"]); + $this->assertEquals ("No book", $array[1]["title"]); + $this->assertEquals ("One book", $array[2]["title"]); + $this->assertEquals ("1 book", $array[3]["title"]); + + $_GET["query"] = NULL; + $_GET["search"] = NULL; + } + + public function tearDown () { + Base::clearDb (); + } + } \ No newline at end of file From 945a28ed8e95587b66c310f1111a1a207b3bf7ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Nov 2013 17:46:28 +0100 Subject: [PATCH 09/70] Update changelog, still a lot to write. It's gonna be a huge release. --- CHANGELOG | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1632745..31d51ea 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,11 +4,13 @@ * Updated the way locales are handled. Should be easier to add new languages. * Fixed display of Cyrillic characters. * Upgraded doT to version 1.0.1, Magnific-Popup to 0.9.8, Normalize.css to 2.1.3, Jquery-cookie to 1.4.0. - * Upgraded * Fixed OPDS stream validity. Reported by Didier. * Added a new check in checkconfig.php to detect case problem between the actual path and the path stored in Calibre database. Try checkconfig.php?full=1. Reported by Ruud. * Fixed the display of the rating stars with Chrome. Thanks to At_Libitum. - * Added a new parameter to avoid splitting the books by first letter. Thanks to At_Libitum. + * Added a new parameter ($config['cops_titles_split_first_letter']) to avoid splitting the books by first letter. Thanks to At_Libitum. + * Fixed non compliant OPDS search (for Stanza, Moon+ Reader, ...). Reported by At_Libitum. + * Fixed the redirection in case the Calibre database is not found. Reported by At_Libitum. + * Updated Chinese, German, Norwegian, Portuguese, Russian translations. Thanks to all the translators. 0.6.2 - 20130913 * Added server side rendering for devices like PRS-TX / Kindle / Cybook. Thanks to all the testers. From b693f18baa53fb9f98994a492fd978c05a2678be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Nov 2013 17:48:19 +0100 Subject: [PATCH 10/70] Changelog again. --- CHANGELOG | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 31d51ea..940f8aa 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,7 +9,8 @@ * Fixed the display of the rating stars with Chrome. Thanks to At_Libitum. * Added a new parameter ($config['cops_titles_split_first_letter']) to avoid splitting the books by first letter. Thanks to At_Libitum. * Fixed non compliant OPDS search (for Stanza, Moon+ Reader, ...). Reported by At_Libitum. - * Fixed the redirection in case the Calibre database is not found. Reported by At_Libitum. + * Fixed the redirection in case the Calibre database is not found. Reported by At_Libitum + * Changed .htaccess to allow the use of password protected catalogs with Sony's eReader (PRS-TX). Thanks to Ruud for the beta testing. * Updated Chinese, German, Norwegian, Portuguese, Russian translations. Thanks to all the translators. 0.6.2 - 20130913 From 34ec943132fc2b616f958ca49c553fb0c6259f54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Nov 2013 18:02:03 +0100 Subject: [PATCH 11/70] Fix warnings --- test/pageMultidatabaseTest.php | 4 --- test/pageTest.php | 47 +--------------------------------- 2 files changed, 1 insertion(+), 50 deletions(-) diff --git a/test/pageMultidatabaseTest.php b/test/pageMultidatabaseTest.php index 59511e2..1094892 100644 --- a/test/pageMultidatabaseTest.php +++ b/test/pageMultidatabaseTest.php @@ -18,10 +18,8 @@ class PageMultiDatabaseTest extends PHPUnit_Framework_TestCase "One book" => dirname(__FILE__) . "/BaseWithOneBook/"); $page = Base::PAGE_INDEX; $query = NULL; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); @@ -42,10 +40,8 @@ class PageMultiDatabaseTest extends PHPUnit_Framework_TestCase "One book" => dirname(__FILE__) . "/BaseWithOneBook/"); $page = Base::PAGE_OPENSEARCH_QUERY; $query = "art"; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); diff --git a/test/pageTest.php b/test/pageTest.php index 6587605..683bd50 100644 --- a/test/pageTest.php +++ b/test/pageTest.php @@ -16,10 +16,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_INDEX; $query = NULL; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); @@ -46,10 +44,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_INDEX; $query = NULL; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $config['cops_calibre_custom_column'] = array ("type1"); @@ -93,10 +89,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_ALL_CUSTOMS; $query = NULL; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $_GET ["custom"] = "1"; @@ -136,10 +130,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_CUSTOM_DETAIL; $query = NULL; - $search = NULL; $qid = "1"; $n = "1"; - $database = NULL; $_GET ["custom"] = "1"; @@ -180,10 +172,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_ALL_AUTHORS; $query = NULL; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $config['cops_author_split_first_letter'] = "0"; @@ -211,10 +201,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_AUTHORS_FIRST_LETTER; $query = NULL; - $search = NULL; $qid = "C"; $n = "1"; - $database = NULL; // Author Lewis Carroll $currentPage = Page::getPage ($page, $qid, $query, $n); @@ -230,10 +218,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_AUTHOR_DETAIL; $query = NULL; - $search = NULL; $qid = "1"; $n = "1"; - $database = NULL; $_SERVER['QUERY_STRING'] = "page=" . Base::PAGE_AUTHOR_DETAIL . "&id=1&n=1"; $config['cops_max_item_per_page'] = 2; @@ -281,10 +267,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_ALL_BOOKS; $query = NULL; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $config['cops_titles_split_first_letter'] = 0; @@ -314,10 +298,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_ALL_BOOKS_LETTER; $query = NULL; - $search = NULL; $qid = "C"; $n = "1"; - $database = NULL; $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); @@ -333,10 +315,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_ALL_SERIES; $query = NULL; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); @@ -352,11 +332,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_SERIE_DETAIL; $query = NULL; - $search = NULL; $qid = "1"; - $n = "1"; - $database = NULL; - + $n = "1"; $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); @@ -371,10 +348,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_ALL_TAGS; $query = NULL; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); @@ -390,10 +365,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_TAG_DETAIL; $query = NULL; - $search = NULL; $qid = "1"; $n = "1"; - $database = NULL; $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); @@ -409,10 +382,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_ALL_LANGUAGES; $query = NULL; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); @@ -428,10 +399,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_LANGUAGE_DETAIL; $query = NULL; - $search = NULL; $qid = "1"; $n = "1"; - $database = NULL; $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); @@ -447,10 +416,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_ALL_RECENT_BOOKS; $query = NULL; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); @@ -488,10 +455,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_BOOK_DETAIL; $query = NULL; - $search = NULL; $qid = "2"; $n = "1"; - $database = NULL; $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); @@ -506,10 +471,8 @@ class PageTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_OPENSEARCH_QUERY; $query = "alice"; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; // Only books returned $currentPage = Page::getPage ($page, $qid, $query, $n); @@ -538,10 +501,8 @@ class PageTest extends PHPUnit_Framework_TestCase { global $config; $page = Base::PAGE_OPENSEARCH_QUERY; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $_GET ["scope"] = "author"; // Match Lewis Carroll @@ -561,10 +522,8 @@ class PageTest extends PHPUnit_Framework_TestCase { global $config; $page = Base::PAGE_OPENSEARCH_QUERY; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $_GET ["scope"] = "series"; // Match Holmes @@ -584,10 +543,8 @@ class PageTest extends PHPUnit_Framework_TestCase { global $config; $page = Base::PAGE_OPENSEARCH_QUERY; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $_GET ["scope"] = "book"; // Match Holmes @@ -606,10 +563,8 @@ class PageTest extends PHPUnit_Framework_TestCase { global $config; $page = Base::PAGE_OPENSEARCH_QUERY; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $_GET ["scope"] = "tag"; // Match Holmes From 263da19735151e5810401552bdf1b7805324ae7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Nov 2013 18:12:36 +0100 Subject: [PATCH 12/70] Again some warnings fix. --- test/pageTest.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/test/pageTest.php b/test/pageTest.php index 683bd50..4af18f7 100644 --- a/test/pageTest.php +++ b/test/pageTest.php @@ -86,7 +86,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageAllCustom () { - global $config; $page = Base::PAGE_ALL_CUSTOMS; $query = NULL; $qid = NULL; @@ -127,7 +126,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageCustomDetail () { - global $config; $page = Base::PAGE_CUSTOM_DETAIL; $query = NULL; $qid = "1"; @@ -198,7 +196,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageAuthorsFirstLetter () { - global $config; $page = Base::PAGE_AUTHORS_FIRST_LETTER; $query = NULL; $qid = "C"; @@ -295,7 +292,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageAllBooksByLetter () { - global $config; $page = Base::PAGE_ALL_BOOKS_LETTER; $query = NULL; $qid = "C"; @@ -329,7 +325,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageSeriesDetail () { - global $config; $page = Base::PAGE_SERIE_DETAIL; $query = NULL; $qid = "1"; @@ -345,7 +340,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageAllTags () { - global $config; $page = Base::PAGE_ALL_TAGS; $query = NULL; $qid = NULL; @@ -362,7 +356,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageTagDetail () { - global $config; $page = Base::PAGE_TAG_DETAIL; $query = NULL; $qid = "1"; @@ -379,7 +372,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageAllLanguages () { - global $config; $page = Base::PAGE_ALL_LANGUAGES; $query = NULL; $qid = NULL; @@ -396,7 +388,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageLanguageDetail () { - global $config; $page = Base::PAGE_LANGUAGE_DETAIL; $query = NULL; $qid = "1"; @@ -413,7 +404,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageRecent () { - global $config; $page = Base::PAGE_ALL_RECENT_BOOKS; $query = NULL; $qid = NULL; @@ -452,7 +442,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageBookDetail () { - global $config; $page = Base::PAGE_BOOK_DETAIL; $query = NULL; $qid = "2"; @@ -468,7 +457,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageSearch () { - global $config; $page = Base::PAGE_OPENSEARCH_QUERY; $query = "alice"; $qid = NULL; @@ -499,7 +487,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageSearchScopeAuthors () { - global $config; $page = Base::PAGE_OPENSEARCH_QUERY; $qid = NULL; $n = "1"; @@ -520,7 +507,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageSearchScopeSeries () { - global $config; $page = Base::PAGE_OPENSEARCH_QUERY; $qid = NULL; $n = "1"; @@ -541,7 +527,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageSearchScopeBooks () { - global $config; $page = Base::PAGE_OPENSEARCH_QUERY; $qid = NULL; $n = "1"; @@ -561,7 +546,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageSearchScopeTags () { - global $config; $page = Base::PAGE_OPENSEARCH_QUERY; $qid = NULL; $n = "1"; From 659cbd4120525c9fc15da363ebef63495634ae05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Nov 2013 18:20:55 +0100 Subject: [PATCH 13/70] Fix warnings. --- test/OPDSTest.php | 6 ------ test/bookTest.php | 1 + test/pageTest.php | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/test/OPDSTest.php b/test/OPDSTest.php index edaa245..9d6aafc 100644 --- a/test/OPDSTest.php +++ b/test/OPDSTest.php @@ -38,10 +38,8 @@ class OpdsTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_INDEX; $query = NULL; - $search = NULL; $qid = NULL; $n = "1"; - $database = NULL; $_SERVER['QUERY_STRING'] = ""; $config['cops_subtitle_default'] = "My subtitle"; @@ -66,10 +64,8 @@ class OpdsTest extends PHPUnit_Framework_TestCase "One book" => dirname(__FILE__) . "/BaseWithOneBook/"); $page = Base::PAGE_AUTHOR_DETAIL; $query = NULL; - $search = NULL; $qid = "1"; $n = "1"; - $database = NULL; $_SERVER['QUERY_STRING'] = "page=" . Base::PAGE_AUTHOR_DETAIL . "&id=1"; $_GET ["db"] = "0"; @@ -87,10 +83,8 @@ class OpdsTest extends PHPUnit_Framework_TestCase global $config; $page = Base::PAGE_AUTHOR_DETAIL; $query = NULL; - $search = NULL; $qid = "1"; $n = "1"; - $database = NULL; $_SERVER['QUERY_STRING'] = "page=" . Base::PAGE_AUTHOR_DETAIL . "&id=1&n=1"; $config['cops_max_item_per_page'] = 2; diff --git a/test/bookTest.php b/test/bookTest.php index 05f3193..eb1c8fa 100644 --- a/test/bookTest.php +++ b/test/bookTest.php @@ -101,6 +101,7 @@ class BookTest extends PHPUnit_Framework_TestCase { // All books by first letter list ($entryArray, $totalNumber) = Book::getBooksByStartingLetter ("T", -1); + $this->assertEquals (-1, $totalNumber); $this->assertCount (3, $entryArray); } diff --git a/test/pageTest.php b/test/pageTest.php index 4af18f7..d51e48a 100644 --- a/test/pageTest.php +++ b/test/pageTest.php @@ -308,7 +308,6 @@ class PageTest extends PHPUnit_Framework_TestCase public function testPageAllSeries () { - global $config; $page = Base::PAGE_ALL_SERIES; $query = NULL; $qid = NULL; From c760534f1d3696f640891b3bc81f3c4e73b1ead3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 27 Nov 2013 16:26:21 +0100 Subject: [PATCH 14/70] Add some badges. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 8f30b32..b0e5b4d 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,9 @@ cops Calibre OPDS (and HTML) PHP Server : light alternative to Calibre content server / Calibre2OPDS See : http://blog.slucas.fr/en/oss/calibre-opds-php-server + +[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/seblucas/cops/badges/quality-score.png?s=e1c87a92ef90b8d666cd9bd4f3612bd10db84364)](https://scrutinizer-ci.com/g/seblucas/cops/) + +[![Code Coverage](https://scrutinizer-ci.com/g/seblucas/cops/badges/coverage.png?s=1e21d8c3bf96d7b0b7cc0e54429fa897ddea1506)](https://scrutinizer-ci.com/g/seblucas/cops/) + +[![Build Status](https://travis-ci.org/seblucas/cops.png)](https://travis-ci.org/seblucas/cops) From 72c5f0dc5e465ccf0520a24584d8a9e4f298a615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 27 Nov 2013 20:35:29 +0100 Subject: [PATCH 15/70] Prepare sauce tests. --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 86c8cda..6a0f86b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,4 +10,8 @@ script: - phpunit - jshint --verbose --show-non-errors util.js - php test/coverage-checker.php clover.xml 45 - \ No newline at end of file +addons: + sauce_connect: + username: "seblucas" + access_key: + secure: "WSdTmwmxYJ5oDJKY+bsU5cbnOKFdQiXmvo3ciWsYSxZF9ksAjLOMcSgHtfMYgpS0jT0TlcLGLwI+PVSF5UrcfLcVEcQByUIDPby5prr8B5GQDHeItIx5Er34R97j9p3/xclJenmj+KoWjnYPzta53lMgm72486PUtZSnGYe/0Kc=" From f8823ae3213c0542a5c42f9bf213fe30a0852b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 27 Nov 2013 22:17:44 +0100 Subject: [PATCH 16/70] Another go at sauce tests. --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6a0f86b..09d5dc0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,8 @@ script: - phpunit - jshint --verbose --show-non-errors util.js - php test/coverage-checker.php clover.xml 45 +env: + - SAUCE_USERNAME=seblucas + - secure: "VVxocvmz6WYr3tZSTA42M/LUhaHoBWw5onh85hnquoMaxspd3tDCyfQIowTTmEXikRh2T0CkTH7X3dhVwRTd/Ha9isja1qDo9Lc2flGCoWICF7WFZuom084+d+O+EWx4WZMAw4Lz4w6a5xflpPKnzNs9B0+de0BdTlQ5qSXVrcA=" addons: - sauce_connect: - username: "seblucas" - access_key: - secure: "WSdTmwmxYJ5oDJKY+bsU5cbnOKFdQiXmvo3ciWsYSxZF9ksAjLOMcSgHtfMYgpS0jT0TlcLGLwI+PVSF5UrcfLcVEcQByUIDPby5prr8B5GQDHeItIx5Er34R97j9p3/xclJenmj+KoWjnYPzta53lMgm72486PUtZSnGYe/0Kc=" + sauce_connect: true From 61b6ec67b35635fc02c95126e7072df6b9c43295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 27 Nov 2013 22:26:35 +0100 Subject: [PATCH 17/70] Try again --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 09d5dc0..64196e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,8 @@ script: - jshint --verbose --show-non-errors util.js - php test/coverage-checker.php clover.xml 45 env: - - SAUCE_USERNAME=seblucas - - secure: "VVxocvmz6WYr3tZSTA42M/LUhaHoBWw5onh85hnquoMaxspd3tDCyfQIowTTmEXikRh2T0CkTH7X3dhVwRTd/Ha9isja1qDo9Lc2flGCoWICF7WFZuom084+d+O+EWx4WZMAw4Lz4w6a5xflpPKnzNs9B0+de0BdTlQ5qSXVrcA=" + global: + - SAUCE_USERNAME=seblucas + - secure:"VVxocvmz6WYr3tZSTA42M/LUhaHoBWw5onh85hnquoMaxspd3tDCyfQIowTTmEXikRh2T0CkTH7X3dhVwRTd/Ha9isja1qDo9Lc2flGCoWICF7WFZuom084+d+O+EWx4WZMAw4Lz4w6a5xflpPKnzNs9B0+de0BdTlQ5qSXVrcA=" addons: sauce_connect: true From cc7b901d9b890ae369e91a5fcaef84aab4f9eb15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 27 Nov 2013 22:35:32 +0100 Subject: [PATCH 18/70] Another try ... --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 64196e9..4afe514 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ script: - php test/coverage-checker.php clover.xml 45 env: global: - - SAUCE_USERNAME=seblucas - - secure:"VVxocvmz6WYr3tZSTA42M/LUhaHoBWw5onh85hnquoMaxspd3tDCyfQIowTTmEXikRh2T0CkTH7X3dhVwRTd/Ha9isja1qDo9Lc2flGCoWICF7WFZuom084+d+O+EWx4WZMAw4Lz4w6a5xflpPKnzNs9B0+de0BdTlQ5qSXVrcA=" + - SAUCE_USERNAME=seblucas + - secure: VVxocvmz6WYr3tZSTA42M/LUhaHoBWw5onh85hnquoMaxspd3tDCyfQIowTTmEXikRh2T0CkTH7X3dhVwRTd/Ha9isja1qDo9Lc2flGCoWICF7WFZuom084+d+O+EWx4WZMAw4Lz4w6a5xflpPKnzNs9B0+de0BdTlQ5qSXVrcA= addons: sauce_connect: true From 764baa5275179d398848b4e655e2af01140c2cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 27 Nov 2013 22:39:52 +0100 Subject: [PATCH 19/70] try to install sausage. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4afe514..c522a40 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,8 @@ php: before_script: - npm install jshint -g - jshint --version + - sudo apt-get install php-pear php5-curl php5-xdebug + - curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php script: - phpunit - jshint --verbose --show-non-errors util.js From 7b1669f69d2f76ae66981d177f5084fd416a0ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 27 Nov 2013 22:47:30 +0100 Subject: [PATCH 20/70] Again another try --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c522a40..fde55bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ php: before_script: - npm install jshint -g - jshint --version - - sudo apt-get install php-pear php5-curl php5-xdebug - curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php script: - phpunit From 9dff0ec16df504323cbbc625689f065a94695d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 27 Nov 2013 22:56:39 +0100 Subject: [PATCH 21/70] Still trying --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fde55bd..c2d5cc6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,12 @@ php: before_script: - npm install jshint -g - jshint --version - - curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php script: - phpunit - jshint --verbose --show-non-errors util.js - php test/coverage-checker.php clover.xml 45 +after_success: + - curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php env: global: - SAUCE_USERNAME=seblucas From e7dc3027271660e3f9670ee0f46c57208f54ab51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 09:44:17 +0100 Subject: [PATCH 22/70] Try to have a smarter Sauce test. --- .travis.yml | 2 +- test/prepareSauceTest.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/prepareSauceTest.sh diff --git a/.travis.yml b/.travis.yml index c2d5cc6..2ff616b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ script: - jshint --verbose --show-non-errors util.js - php test/coverage-checker.php clover.xml 45 after_success: - - curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php + - test/prepareSauceTest.sh env: global: - SAUCE_USERNAME=seblucas diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh new file mode 100644 index 0000000..ba0d1ff --- /dev/null +++ b/test/prepareSauceTest.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +PHP_VERSION=`php -v|grep --only-matching --perl-regexp "5\.\\d+\"` + +if [[ $PHP_VERSION != "5.5" ]] + then + echo "Bad PHP version" + exit +fi + +echo "Good PHP version" + +curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php \ No newline at end of file From fd76478e8fa3490f7b77d71aa2a82970fe0d34d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 09:55:50 +0100 Subject: [PATCH 23/70] Another try --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2ff616b..28eb32d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ script: - jshint --verbose --show-non-errors util.js - php test/coverage-checker.php clover.xml 45 after_success: + - chmod +x test/prepareSauceTest.sh - test/prepareSauceTest.sh env: global: From 8caa548ec0a452ca338c12fb801fa72a1ece20df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 10:06:31 +0100 Subject: [PATCH 24/70] Bad test --- test/prepareSauceTest.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index ba0d1ff..86ea132 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -1,13 +1,13 @@ -#!/bin/bash - -PHP_VERSION=`php -v|grep --only-matching --perl-regexp "5\.\\d+\"` - -if [[ $PHP_VERSION != "5.5" ]] - then - echo "Bad PHP version" - exit -fi - -echo "Good PHP version" - +#!/usr/bin/env bash + +PHP_VERSION=`php -v|grep --only-matching --perl-regexp "5\.\\d+\"` + +if [[ $PHP_VERSION != "5.5" ]] + then + echo "Bad PHP version" + exit +fi + +echo "Good PHP version" + curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php \ No newline at end of file From 876fba3053476a9eb858532917cc01c404425911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 10:20:34 +0100 Subject: [PATCH 25/70] Typo again --- test/prepareSauceTest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index 86ea132..a75348f 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -PHP_VERSION=`php -v|grep --only-matching --perl-regexp "5\.\\d+\"` +PHP_VERSION=`php -v|grep --only-matching --perl-regexp "5\.\\d+"` if [[ $PHP_VERSION != "5.5" ]] then From cacbb94e86bc5cb5c884ecc8643926761c658b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 10:41:14 +0100 Subject: [PATCH 26/70] again. --- test/prepareSauceTest.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index a75348f..1425f88 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash PHP_VERSION=`php -v|grep --only-matching --perl-regexp "5\.\\d+"` +echo $PHP_VERSION + if [[ $PHP_VERSION != "5.5" ]] then From 99768e82eea79686a53c8e5566b1f60de3f03a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 11:11:07 +0100 Subject: [PATCH 27/70] Hopefully it'll work --- test/prepareSauceTest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index 1425f88..10d65cc 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -PHP_VERSION=`php -v|grep --only-matching --perl-regexp "5\.\\d+"` +PHP_VERSION=`php -v|grep --only-matching --perl-regexp "PHP 5\.\\d+"` echo $PHP_VERSION -if [[ $PHP_VERSION != "5.5" ]] +if [[ $PHP_VERSION != "PHP 5.5" ]] then echo "Bad PHP version" exit From 198323773d9d51dec6876d0ac2c6349faa0c1799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 11:45:54 +0100 Subject: [PATCH 28/70] Finally maybe it'll work. --- .travis.yml | 2 + test/Sauce.php | 136 ++++++++++++++++++++++++++++++++++++ test/config_local.php.sauce | 23 ++++++ test/prepareSauceTest.sh | 5 +- 4 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 test/Sauce.php create mode 100644 test/config_local.php.sauce diff --git a/.travis.yml b/.travis.yml index 28eb32d..bba4375 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,3 +19,5 @@ env: - secure: VVxocvmz6WYr3tZSTA42M/LUhaHoBWw5onh85hnquoMaxspd3tDCyfQIowTTmEXikRh2T0CkTH7X3dhVwRTd/Ha9isja1qDo9Lc2flGCoWICF7WFZuom084+d+O+EWx4WZMAw4Lz4w6a5xflpPKnzNs9B0+de0BdTlQ5qSXVrcA= addons: sauce_connect: true + hosts: + - cops-travis diff --git a/test/Sauce.php b/test/Sauce.php new file mode 100644 index 0000000..2833d4f --- /dev/null +++ b/test/Sauce.php @@ -0,0 +1,136 @@ + 'firefox', + // 'desiredCapabilities' => array( + // 'version' => '15', + // 'platform' => 'Windows 2012', + // ) + // ), + // // run IE9 on Windows 7 on Sauce + // array( + // 'browserName' => 'internet explorer', + // 'desiredCapabilities' => array( + // 'version' => '9', + // 'platform' => 'Windows 7', + // ) + // ), + // // run IE10 on Windows 8 on Sauce + // array( + // 'browserName' => 'internet explorer', + // 'desiredCapabilities' => array( + // 'version' => '10', + // 'platform' => 'Windows 8', + // ) + // ), + // // run Opera 12 on Windows 7 on Sauce + // array( + // 'browserName' => 'opera', + // 'desiredCapabilities' => array( + // 'version' => '12', + // 'platform' => 'Windows 7', + // ) + // ), + // // run Mobile Safari on iOS + // array( + // 'browserName' => '', + // 'desiredCapabilities' => array( + // 'app' => 'safari', + // 'device' => 'iPhone Simulator', + // 'version' => '6.1', + // 'platform' => 'Mac 10.8', + // ) + // ), + // run Chrome on Linux on Sauce + array( + 'browserName' => 'chrome', + 'desiredCapabilities' => array( + 'version' => '30', + 'platform' => 'Linux' + ) + ) + // run Mobile Browser on Android + // array( + // 'browserName' => 'Android', + // 'desiredCapabilities' => array( + // 'version' => '4.0', + // 'platform' => 'Linux', + // ) + // ) + + // run Chrome locally + //array( + //'browserName' => 'chrome', + //'local' => true, + //'sessionStrategy' => 'shared' + //) + ); + + public function setUp() + { + $caps = $this->getDesiredCapabilities(); + $caps['build'] = getenv ("TRAVIS_JOB_NUMBER"); + $caps['tunnel-identifier'] = getenv ("TRAVIS_JOB_NUMBER"); + $caps['name'] = "COPS "; + $this->setDesiredCapabilities($caps); + parent::setUp (); + } + + public function setUpPage() + { + $this->url('http://cops-travis:8888/index.php'); + } + + public function string_to_ascii($string) + { + $ascii = NULL; + + for ($i = 0; $i < strlen($string); $i++) + { + $ascii += ord($string[$i]); + } + + return mb_detect_encoding($string) . "X" . $ascii; + } + + public function testTitle() + { + $driver = $this; + $title_test = function($value) use ($driver) { + $text = $driver->byXPath('//h1')->text (); + return $text == $value; + }; + + $this->spinAssert("Home Title", $title_test, [ "COPS DEMO" ]); + + $author = $this->byXPath ('//h2[contains(text(), "Authors")]'); + $author->click (); + + $this->spinAssert("Author Title", $title_test, [ "AUTHORS" ]); + + $cog = $this->byId ("searchImage"); + // try { + // $search = $this->byName ("query"); + // $this->fail (); + // } + // catch (Exception $e) { + // } + + $search = $this->byName ("query"); + $this->assertFalse ($search->displayed ()); + + $cog->click (); + //$this->implicitWait(2000); + + $search = $this->byName ("query"); + $this->assertTrue ($search->displayed ()); + } +} diff --git a/test/config_local.php.sauce b/test/config_local.php.sauce new file mode 100644 index 0000000..bcc7c6d --- /dev/null +++ b/test/config_local.php.sauce @@ -0,0 +1,23 @@ + /dev/null & +vendor/bin/phpunit Sauce.php \ No newline at end of file From d5873492e7234ff2ba814bb5d5a2da82aec9017f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 11:50:30 +0100 Subject: [PATCH 29/70] And again --- test/prepareSauceTest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index 831a8d1..46b0739 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -15,4 +15,4 @@ echo "Good PHP version" curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php cp test/config_local.php.sauce config_local.php php -S localhost:8888 2> /dev/null & -vendor/bin/phpunit Sauce.php \ No newline at end of file +vendor/bin/phpunit test/Sauce.php \ No newline at end of file From d6f6e65d56ad7150c0b4c142adba295649916fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 12:06:30 +0100 Subject: [PATCH 30/70] Silly me. --- test/Sauce.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/Sauce.php b/test/Sauce.php index 2833d4f..07aae6a 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -3,8 +3,6 @@ require_once 'vendor/autoload.php'; class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase - -class WebDriverDemo extends WebDriverTestCase { public static $browsers = array( // // run FF15 on Windows 8 on Sauce From 685667756680d02634c56ce221854ff74e7fa048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 12:24:19 +0100 Subject: [PATCH 31/70] Another try --- test/Sauce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Sauce.php b/test/Sauce.php index 07aae6a..91edf94 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -84,7 +84,7 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase public function setUpPage() { - $this->url('http://cops-travis:8888/index.php'); + $this->url('http://localhost:8888/index.php'); } public function string_to_ascii($string) From a76776fd8e6ad207f9c94c8a923482d4a7333e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 13:45:10 +0100 Subject: [PATCH 32/70] Try another way --- .travis.yml | 1 - test/prepareSauceTest.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bba4375..7d208da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,5 @@ env: - SAUCE_USERNAME=seblucas - secure: VVxocvmz6WYr3tZSTA42M/LUhaHoBWw5onh85hnquoMaxspd3tDCyfQIowTTmEXikRh2T0CkTH7X3dhVwRTd/Ha9isja1qDo9Lc2flGCoWICF7WFZuom084+d+O+EWx4WZMAw4Lz4w6a5xflpPKnzNs9B0+de0BdTlQ5qSXVrcA= addons: - sauce_connect: true hosts: - cops-travis diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index 46b0739..0a1d9f1 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -12,6 +12,7 @@ fi echo "Good PHP version" +curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php cp test/config_local.php.sauce config_local.php php -S localhost:8888 2> /dev/null & From 61d7aa70da86914b245f0a46e2829d2503eb5b50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 13:52:21 +0100 Subject: [PATCH 33/70] Another try. --- test/Sauce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Sauce.php b/test/Sauce.php index 91edf94..b9a731f 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -76,7 +76,7 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase { $caps = $this->getDesiredCapabilities(); $caps['build'] = getenv ("TRAVIS_JOB_NUMBER"); - $caps['tunnel-identifier'] = getenv ("TRAVIS_JOB_NUMBER"); + //$caps['tunnel-identifier'] = getenv ("TRAVIS_JOB_NUMBER"); $caps['name'] = "COPS "; $this->setDesiredCapabilities($caps); parent::setUp (); From 161c2653b454682a9e650cc32cc6811a188303a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 14:01:47 +0100 Subject: [PATCH 34/70] Another try again. --- test/Sauce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Sauce.php b/test/Sauce.php index b9a731f..5b4348f 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -76,7 +76,7 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase { $caps = $this->getDesiredCapabilities(); $caps['build'] = getenv ("TRAVIS_JOB_NUMBER"); - //$caps['tunnel-identifier'] = getenv ("TRAVIS_JOB_NUMBER"); + $caps['tunnel_id'] = getenv ("TRAVIS_JOB_NUMBER"); $caps['name'] = "COPS "; $this->setDesiredCapabilities($caps); parent::setUp (); From faf67b89644e414221243177cfda7386c54ddb09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 14:09:07 +0100 Subject: [PATCH 35/70] Getting closer. --- test/Sauce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Sauce.php b/test/Sauce.php index 5b4348f..4c4831c 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -84,7 +84,7 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase public function setUpPage() { - $this->url('http://localhost:8888/index.php'); + $this->url('http://cops-travis:8888/index.php'); } public function string_to_ascii($string) From 136315a492128f37de53ebdbba0879c749c33c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 14:17:21 +0100 Subject: [PATCH 36/70] And try again --- test/Sauce.php | 2 +- test/prepareSauceTest.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Sauce.php b/test/Sauce.php index 4c4831c..60f2d51 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -84,7 +84,7 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase public function setUpPage() { - $this->url('http://cops-travis:8888/index.php'); + $this->url('http://127.0.0.1:8888/index.php'); } public function string_to_ascii($string) diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index 0a1d9f1..e8e1d2b 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -15,5 +15,5 @@ echo "Good PHP version" curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php cp test/config_local.php.sauce config_local.php -php -S localhost:8888 2> /dev/null & +php -S 127.0.0.1:8888 2> /dev/null & vendor/bin/phpunit test/Sauce.php \ No newline at end of file From 016f99c1fa636bc03038085dade60b692f308d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 14:49:14 +0100 Subject: [PATCH 37/70] And again. --- test/Sauce.php | 2 +- test/prepareSauceTest.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Sauce.php b/test/Sauce.php index 60f2d51..f5167cd 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -76,7 +76,7 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase { $caps = $this->getDesiredCapabilities(); $caps['build'] = getenv ("TRAVIS_JOB_NUMBER"); - $caps['tunnel_id'] = getenv ("TRAVIS_JOB_NUMBER"); + //$caps['tunnel_id'] = getenv ("TRAVIS_JOB_NUMBER"); $caps['name'] = "COPS "; $this->setDesiredCapabilities($caps); parent::setUp (); diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index e8e1d2b..b0ebeba 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -12,7 +12,7 @@ fi echo "Good PHP version" -curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash +curl https://gist.github.com/seblucas/7692094/raw/e2a090e6ea639a0d700e6d02cee048fa2f6c8617/sauce_connect_setup.sh | bash curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php cp test/config_local.php.sauce config_local.php php -S 127.0.0.1:8888 2> /dev/null & From 144d3b81b9d85174164700056b6add08a32e74b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 15:00:42 +0100 Subject: [PATCH 38/70] It connected but the test did not work. --- test/Sauce.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/Sauce.php b/test/Sauce.php index f5167cd..c268366 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -106,6 +106,8 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase $text = $driver->byXPath('//h1')->text (); return $text == $value; }; + + $this->implicitWait(3000); $this->spinAssert("Home Title", $title_test, [ "COPS DEMO" ]); From d420948d59280ec29e3dea79cfce9629fec128b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 15:14:15 +0100 Subject: [PATCH 39/70] Erreur --- test/Sauce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Sauce.php b/test/Sauce.php index c268366..9518a39 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -107,7 +107,7 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase return $text == $value; }; - $this->implicitWait(3000); + sleep(3); $this->spinAssert("Home Title", $title_test, [ "COPS DEMO" ]); From ce8223116cc99e199dc42fbd8499da4679d9415f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 15:27:50 +0100 Subject: [PATCH 40/70] And try again --- test/config_local.php.sauce | 2 +- test/prepareSauceTest.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/config_local.php.sauce b/test/config_local.php.sauce index bcc7c6d..85cd54e 100644 --- a/test/config_local.php.sauce +++ b/test/config_local.php.sauce @@ -7,7 +7,7 @@ * containing all the formats. * BEWARE : it has to end with a / */ - $config['calibre_directory'] = 'test/BaseWithSomeBooks/'; + $config['calibre_directory'] = './test/BaseWithSomeBooks/'; /* * Catalog's title diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index b0ebeba..56af4b7 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -15,5 +15,5 @@ echo "Good PHP version" curl https://gist.github.com/seblucas/7692094/raw/e2a090e6ea639a0d700e6d02cee048fa2f6c8617/sauce_connect_setup.sh | bash curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php cp test/config_local.php.sauce config_local.php -php -S 127.0.0.1:8888 2> /dev/null & +php -S 127.0.0.1:8888 & vendor/bin/phpunit test/Sauce.php \ No newline at end of file From 3673716e89370eaf31d473f677fbb3f80aba3f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 15:39:05 +0100 Subject: [PATCH 41/70] More wait. --- test/Sauce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Sauce.php b/test/Sauce.php index 9518a39..254303f 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -107,7 +107,7 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase return $text == $value; }; - sleep(3); + sleep(10); $this->spinAssert("Home Title", $title_test, [ "COPS DEMO" ]); From 7b1882dbccec093de7a150a03f8a86aaa9a5abe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 16:14:57 +0100 Subject: [PATCH 42/70] Another try --- test/Sauce.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Sauce.php b/test/Sauce.php index 254303f..456b11b 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -107,9 +107,9 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase return $text == $value; }; - sleep(10); + //sleep(10); - $this->spinAssert("Home Title", $title_test, [ "COPS DEMO" ]); + $this->spinAssert("Home Title", $title_test, [ "COPS DEMO" ], 20); $author = $this->byXPath ('//h2[contains(text(), "Authors")]'); $author->click (); From 758833375d9f37637e901541b892be821b84b95b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 16:21:40 +0100 Subject: [PATCH 43/70] Should not hurt --- test/prepareSauceTest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index 56af4b7..dcfeae4 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -14,6 +14,6 @@ echo "Good PHP version" curl https://gist.github.com/seblucas/7692094/raw/e2a090e6ea639a0d700e6d02cee048fa2f6c8617/sauce_connect_setup.sh | bash curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php -cp test/config_local.php.sauce config_local.php +cp -v test/config_local.php.sauce config_local.php php -S 127.0.0.1:8888 & vendor/bin/phpunit test/Sauce.php \ No newline at end of file From c2ee1733e01177832599759ae7bb86cdc3c48ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 16:28:41 +0100 Subject: [PATCH 44/70] another try --- test/Sauce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Sauce.php b/test/Sauce.php index 456b11b..12cb601 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -84,7 +84,7 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase public function setUpPage() { - $this->url('http://127.0.0.1:8888/index.php'); + $this->url('http://127.0.0.1:8888/checkconfig.php'); } public function string_to_ascii($string) From a361b31fbaf359792a5fe197a69df320e300e0be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 17:45:57 +0100 Subject: [PATCH 45/70] Change browser --- test/Sauce.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/Sauce.php b/test/Sauce.php index 12cb601..62dd95b 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -5,14 +5,14 @@ require_once 'vendor/autoload.php'; class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase { public static $browsers = array( - // // run FF15 on Windows 8 on Sauce - // array( - // 'browserName' => 'firefox', - // 'desiredCapabilities' => array( - // 'version' => '15', - // 'platform' => 'Windows 2012', - // ) - // ), + // run FF15 on Windows 8 on Sauce + array( + 'browserName' => 'firefox', + 'desiredCapabilities' => array( + 'version' => '15', + 'platform' => 'Windows 2012', + ) + ) // // run IE9 on Windows 7 on Sauce // array( // 'browserName' => 'internet explorer', @@ -48,13 +48,13 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase // ) // ), // run Chrome on Linux on Sauce - array( - 'browserName' => 'chrome', - 'desiredCapabilities' => array( - 'version' => '30', - 'platform' => 'Linux' - ) - ) + // array( + // 'browserName' => 'chrome', + // 'desiredCapabilities' => array( + // 'version' => '30', + // 'platform' => 'Linux' + // ) + // ) // run Mobile Browser on Android // array( // 'browserName' => 'Android', @@ -84,7 +84,7 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase public function setUpPage() { - $this->url('http://127.0.0.1:8888/checkconfig.php'); + $this->url('http://127.0.0.1:8888/index.php'); } public function string_to_ascii($string) From 88622fcc71af694c5ade4ae5f08e75fbd9af55a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 17:52:43 +0100 Subject: [PATCH 46/70] Another try again --- test/prepareSauceTest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index dcfeae4..67665df 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -16,4 +16,4 @@ curl https://gist.github.com/seblucas/7692094/raw/e2a090e6ea639a0d700e6d02cee048 curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php cp -v test/config_local.php.sauce config_local.php php -S 127.0.0.1:8888 & -vendor/bin/phpunit test/Sauce.php \ No newline at end of file +vendor/bin/phpunit --no-configuration test/Sauce.php \ No newline at end of file From 082aa11cebceabb5c8e618ad21053294cd67d071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 18:01:30 +0100 Subject: [PATCH 47/70] Test again with IE --- test/Sauce.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/test/Sauce.php b/test/Sauce.php index 62dd95b..7172bd1 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -5,14 +5,14 @@ require_once 'vendor/autoload.php'; class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase { public static $browsers = array( - // run FF15 on Windows 8 on Sauce - array( - 'browserName' => 'firefox', - 'desiredCapabilities' => array( - 'version' => '15', - 'platform' => 'Windows 2012', - ) - ) + // // run FF15 on Windows 8 on Sauce + // array( + // 'browserName' => 'firefox', + // 'desiredCapabilities' => array( + // 'version' => '15', + // 'platform' => 'Windows 2012', + // ) + // ), // // run IE9 on Windows 7 on Sauce // array( // 'browserName' => 'internet explorer', @@ -21,14 +21,14 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase // 'platform' => 'Windows 7', // ) // ), - // // run IE10 on Windows 8 on Sauce - // array( - // 'browserName' => 'internet explorer', - // 'desiredCapabilities' => array( - // 'version' => '10', - // 'platform' => 'Windows 8', - // ) - // ), + // run IE10 on Windows 8 on Sauce + array( + 'browserName' => 'internet explorer', + 'desiredCapabilities' => array( + 'version' => '10', + 'platform' => 'Windows 8', + ) + ) // // run Opera 12 on Windows 7 on Sauce // array( // 'browserName' => 'opera', @@ -109,7 +109,7 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase //sleep(10); - $this->spinAssert("Home Title", $title_test, [ "COPS DEMO" ], 20); + $this->spinAssert("Home Title", $title_test, [ "COPS" ], 25); $author = $this->byXPath ('//h2[contains(text(), "Authors")]'); $author->click (); From 834ad620f616e1d11eb8b8a3595e53aca086a6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 18:12:57 +0100 Subject: [PATCH 48/70] Test with server side rendering --- test/config_local.php.sauce | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/test/config_local.php.sauce b/test/config_local.php.sauce index 85cd54e..a8c7b9e 100644 --- a/test/config_local.php.sauce +++ b/test/config_local.php.sauce @@ -14,10 +14,4 @@ */ $config['cops_title_default'] = "COPS"; - /* - * use URL rewriting for downloading of ebook in HTML catalog - * See README for more information - * 1 : enable - * 0 : disable - */ - $config['cops_use_url_rewriting'] = "0"; + $config['cops_server_side_render'] = "Kindle|EBRD1101|EBRD1201|cybook|MSIE"; From 9fc3706209a7dbc59f45836796cbe486cd9840dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 18:25:19 +0100 Subject: [PATCH 49/70] Disable client side rendering with sauce. Enable all tests. --- test/Sauce.php | 98 ++++++++++++++++++------------------- test/config_local.php.sauce | 2 +- 2 files changed, 49 insertions(+), 51 deletions(-) diff --git a/test/Sauce.php b/test/Sauce.php index 7172bd1..25910d8 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -5,22 +5,22 @@ require_once 'vendor/autoload.php'; class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase { public static $browsers = array( - // // run FF15 on Windows 8 on Sauce - // array( - // 'browserName' => 'firefox', - // 'desiredCapabilities' => array( - // 'version' => '15', - // 'platform' => 'Windows 2012', - // ) - // ), - // // run IE9 on Windows 7 on Sauce - // array( - // 'browserName' => 'internet explorer', - // 'desiredCapabilities' => array( - // 'version' => '9', - // 'platform' => 'Windows 7', - // ) - // ), + // run FF15 on Windows 8 on Sauce + array( + 'browserName' => 'firefox', + 'desiredCapabilities' => array( + 'version' => '15', + 'platform' => 'Windows 2012', + ) + ), + // run IE9 on Windows 7 on Sauce + array( + 'browserName' => 'internet explorer', + 'desiredCapabilities' => array( + 'version' => '9', + 'platform' => 'Windows 7', + ) + ), // run IE10 on Windows 8 on Sauce array( 'browserName' => 'internet explorer', @@ -28,33 +28,33 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase 'version' => '10', 'platform' => 'Windows 8', ) - ) - // // run Opera 12 on Windows 7 on Sauce - // array( - // 'browserName' => 'opera', - // 'desiredCapabilities' => array( - // 'version' => '12', - // 'platform' => 'Windows 7', - // ) - // ), - // // run Mobile Safari on iOS - // array( - // 'browserName' => '', - // 'desiredCapabilities' => array( - // 'app' => 'safari', - // 'device' => 'iPhone Simulator', - // 'version' => '6.1', - // 'platform' => 'Mac 10.8', - // ) - // ), + ), + // run Opera 12 on Windows 7 on Sauce + array( + 'browserName' => 'opera', + 'desiredCapabilities' => array( + 'version' => '12', + 'platform' => 'Windows 7', + ) + ), + // run Mobile Safari on iOS + array( + 'browserName' => '', + 'desiredCapabilities' => array( + 'app' => 'safari', + 'device' => 'iPhone Simulator', + 'version' => '6.1', + 'platform' => 'Mac 10.8', + ) + ), // run Chrome on Linux on Sauce - // array( - // 'browserName' => 'chrome', - // 'desiredCapabilities' => array( - // 'version' => '30', - // 'platform' => 'Linux' - // ) - // ) + array( + 'browserName' => 'chrome', + 'desiredCapabilities' => array( + 'version' => '30', + 'platform' => 'Linux' + ) + ) // run Mobile Browser on Android // array( // 'browserName' => 'Android', @@ -107,9 +107,8 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase return $text == $value; }; - //sleep(10); - $this->spinAssert("Home Title", $title_test, [ "COPS" ], 25); + $this->spinAssert("Home Title", $title_test, [ "COPS" ]); $author = $this->byXPath ('//h2[contains(text(), "Authors")]'); $author->click (); @@ -124,13 +123,12 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase // catch (Exception $e) { // } - $search = $this->byName ("query"); - $this->assertFalse ($search->displayed ()); + // $search = $this->byName ("query"); + // $this->assertFalse ($search->displayed ()); - $cog->click (); - //$this->implicitWait(2000); + // $cog->click (); - $search = $this->byName ("query"); - $this->assertTrue ($search->displayed ()); + // $search = $this->byName ("query"); + // $this->assertTrue ($search->displayed ()); } } diff --git a/test/config_local.php.sauce b/test/config_local.php.sauce index a8c7b9e..dfadb42 100644 --- a/test/config_local.php.sauce +++ b/test/config_local.php.sauce @@ -14,4 +14,4 @@ */ $config['cops_title_default'] = "COPS"; - $config['cops_server_side_render'] = "Kindle|EBRD1101|EBRD1201|cybook|MSIE"; + $config['cops_server_side_render'] = "."; From 1c744d73f55ceb80b487cfa05da77328e62d1fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 19:58:24 +0100 Subject: [PATCH 50/70] Another comment --- test/Sauce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Sauce.php b/test/Sauce.php index 25910d8..ef7693d 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -115,7 +115,7 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase $this->spinAssert("Author Title", $title_test, [ "AUTHORS" ]); - $cog = $this->byId ("searchImage"); + // $cog = $this->byId ("searchImage"); // try { // $search = $this->byName ("query"); // $this->fail (); From 58a3a62a2af21defe950946c86958ea2829f70bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 20:49:52 +0100 Subject: [PATCH 51/70] Let's try with PHP 5.4 --- test/config_local.php.sauce | 2 +- test/prepareSauceTest.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/config_local.php.sauce b/test/config_local.php.sauce index dfadb42..0818b69 100644 --- a/test/config_local.php.sauce +++ b/test/config_local.php.sauce @@ -14,4 +14,4 @@ */ $config['cops_title_default'] = "COPS"; - $config['cops_server_side_render'] = "."; + // $config['cops_server_side_render'] = "."; diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index 67665df..76a3239 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -4,7 +4,7 @@ PHP_VERSION=`php -v|grep --only-matching --perl-regexp "PHP 5\.\\d+"` echo $PHP_VERSION -if [[ $PHP_VERSION != "PHP 5.5" ]] +if [[ $PHP_VERSION != "PHP 5.4" ]] then echo "Bad PHP version" exit From 8a027b5e485a96e4f0e87e2624dadcfae9e79c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 20:59:07 +0100 Subject: [PATCH 52/70] Let's try that. --- index.php | 1 - 1 file changed, 1 deletion(-) diff --git a/index.php b/index.php index 5fc64c7..dc5f201 100644 --- a/index.php +++ b/index.php @@ -70,7 +70,6 @@ - " /> " media="screen" /> From c0a4a892ed21ea75ee0ff7aec3acf2529c35b177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 21:19:06 +0100 Subject: [PATCH 53/70] Add a desesperate test --- index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index dc5f201..5478903 100644 --- a/index.php +++ b/index.php @@ -79,6 +79,8 @@ $(document).ready(function() { // Handler for .ready() called. + try + { var url = ""; $.when($.get('templates/default/header.html'), @@ -116,7 +118,10 @@ } handleLinks (); }); - + } + catch (e) { + alert (e.message); + } }); From 7497e6d00404c0af428916763c5adfdfbd64fa27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 28 Nov 2013 21:41:16 +0100 Subject: [PATCH 54/70] Last test before a full revert --- index.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 5478903..4349a5c 100644 --- a/index.php +++ b/index.php @@ -75,10 +75,10 @@ - + Date: Thu, 28 Nov 2013 22:02:44 +0100 Subject: [PATCH 56/70] Revert --- index.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/index.php b/index.php index 741d971..5fc64c7 100644 --- a/index.php +++ b/index.php @@ -43,8 +43,6 @@ $test = Base::getDb (); } - $texteDebug = "Top "; - header ("Content-Type:text/html;charset=utf-8"); ?> @@ -72,16 +70,16 @@ + " /> " media="screen" /> - + - + Date: Thu, 28 Nov 2013 22:03:25 +0100 Subject: [PATCH 57/70] Server side again --- test/config_local.php.sauce | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/config_local.php.sauce b/test/config_local.php.sauce index 0818b69..dfadb42 100644 --- a/test/config_local.php.sauce +++ b/test/config_local.php.sauce @@ -14,4 +14,4 @@ */ $config['cops_title_default'] = "COPS"; - // $config['cops_server_side_render'] = "."; + $config['cops_server_side_render'] = "."; From adc02ae320c583d489ebd2113c061a21663f94bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Fri, 29 Nov 2013 07:07:22 +0100 Subject: [PATCH 58/70] Try to debug manually --- test/config_local.php.sauce | 2 +- test/prepareSauceTest.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/config_local.php.sauce b/test/config_local.php.sauce index dfadb42..0818b69 100644 --- a/test/config_local.php.sauce +++ b/test/config_local.php.sauce @@ -14,4 +14,4 @@ */ $config['cops_title_default'] = "COPS"; - $config['cops_server_side_render'] = "."; + // $config['cops_server_side_render'] = "."; diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index 76a3239..0cbd157 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -16,4 +16,5 @@ curl https://gist.github.com/seblucas/7692094/raw/e2a090e6ea639a0d700e6d02cee048 curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php cp -v test/config_local.php.sauce config_local.php php -S 127.0.0.1:8888 & -vendor/bin/phpunit --no-configuration test/Sauce.php \ No newline at end of file +#vendor/bin/phpunit --no-configuration test/Sauce.php +sleep 300 From ef4cbb79cd62ef741d0772ee9fb551446dac2114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Fri, 29 Nov 2013 07:32:08 +0100 Subject: [PATCH 59/70] Getting closer maybe. --- base.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/base.php b/base.php index 9cb5887..8a43b6b 100644 --- a/base.php +++ b/base.php @@ -192,6 +192,9 @@ function localize($phrase, $count=-1, $reset=false) { } function addURLParameter($urlParams, $paramName, $paramValue) { + if (empty ($urlParams)) { + $urlParams = ""; + } $start = ""; if (preg_match ("#^\?(.*)#", $urlParams, $matches)) { $start = "?"; From 13d0b4c471f19a9215b4e3c51af38aba0ea68c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Fri, 29 Nov 2013 09:34:32 +0100 Subject: [PATCH 60/70] Fix a problem with PHP embedded server. $_SERVER['QUERY_STRING'] is not set if it's empty. --- base.php | 15 +++++++++++---- index.php | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/base.php b/base.php index 8a43b6b..af57961 100644 --- a/base.php +++ b/base.php @@ -16,6 +16,13 @@ function useServerSideRendering () { return preg_match("/" . $config['cops_server_side_render'] . "/", $_SERVER['HTTP_USER_AGENT']); } +function getQueryString () { + if ( isset($_SERVER['QUERY_STRING']) ) { + return $_SERVER['QUERY_STRING']; + } + return ""; +} + function getURLParam ($name, $default = NULL) { if (!empty ($_GET) && isset($_GET[$name]) && $_GET[$name] != "") { return $_GET[$name]; @@ -481,8 +488,8 @@ class Page public function getNextLink () { - $currentUrl = $_SERVER['QUERY_STRING']; - $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . $_SERVER['QUERY_STRING']); + $currentUrl = getQueryString (); + $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . getQueryString ()); if (($this->n) * getCurrentOption ("max_item_per_page") < $this->totalNumber) { return new LinkNavigation ($currentUrl . "&n=" . ($this->n + 1), "next", localize ("paging.next.alternate")); } @@ -491,8 +498,8 @@ class Page public function getPrevLink () { - $currentUrl = $_SERVER['QUERY_STRING']; - $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . $_SERVER['QUERY_STRING']); + $currentUrl = getQueryString (); + $currentUrl = preg_replace ("/\&n=.*?$/", "", "?" . getQueryString ()); if ($this->n > 1) { return new LinkNavigation ($currentUrl . "&n=" . ($this->n - 1), "previous", localize ("paging.previous.alternate")); } diff --git a/index.php b/index.php index 5fc64c7..c018c55 100644 --- a/index.php +++ b/index.php @@ -80,7 +80,7 @@ $(document).ready(function() { // Handler for .ready() called. - var url = ""; + var url = ""; $.when($.get('templates/default/header.html'), $.get('templates/default/footer.html'), From 3a3d4731617038025b1f49bd896795161a232fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Fri, 29 Nov 2013 09:44:51 +0100 Subject: [PATCH 61/70] Should work --- test/prepareSauceTest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index 0cbd157..61ff7e5 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -16,5 +16,5 @@ curl https://gist.github.com/seblucas/7692094/raw/e2a090e6ea639a0d700e6d02cee048 curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php cp -v test/config_local.php.sauce config_local.php php -S 127.0.0.1:8888 & -#vendor/bin/phpunit --no-configuration test/Sauce.php -sleep 300 +vendor/bin/phpunit --no-configuration test/Sauce.php + From b70255da84ea3d433ea9db8a52e8682b129fc0fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Fri, 29 Nov 2013 10:47:25 +0100 Subject: [PATCH 62/70] Should work better. --- test/Sauce.php | 45 +++++++++++++++++++------------------ test/config_local.php.sauce | 2 +- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/test/Sauce.php b/test/Sauce.php index ef7693d..c07ec5d 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -2,7 +2,7 @@ require_once 'vendor/autoload.php'; -class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase +class Cops extends Sauce\Sausage\WebDriverTestCase { public static $browsers = array( // run FF15 on Windows 8 on Sauce @@ -74,17 +74,21 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase public function setUp() { - $caps = $this->getDesiredCapabilities(); - $caps['build'] = getenv ("TRAVIS_JOB_NUMBER"); - //$caps['tunnel_id'] = getenv ("TRAVIS_JOB_NUMBER"); - $caps['name'] = "COPS "; - $this->setDesiredCapabilities($caps); - parent::setUp (); + if (isset ($_SERVER["TRAVIS_JOB_NUMBER"])) { + $caps = $this->getDesiredCapabilities(); + $caps['build'] = getenv ("TRAVIS_JOB_NUMBER"); + $this->setDesiredCapabilities($caps); + } + parent::setUp (); } public function setUpPage() { - $this->url('http://127.0.0.1:8888/index.php'); + if (isset ($_SERVER["TRAVIS_JOB_NUMBER"])) { + $this->url('http://127.0.0.1:8888/index.php'); + } else { + $this->url('http://cops-demo.slucas.fr/index.php'); + } } public function string_to_ascii($string) @@ -108,27 +112,24 @@ class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase }; - $this->spinAssert("Home Title", $title_test, [ "COPS" ]); + $this->spinAssert("Home Title", $title_test, [ "COPS DEMO" ]); $author = $this->byXPath ('//h2[contains(text(), "Authors")]'); $author->click (); $this->spinAssert("Author Title", $title_test, [ "AUTHORS" ]); + } + + public function testCog() + { + $cog = $this->byId ("searchImage"); - // $cog = $this->byId ("searchImage"); - // try { - // $search = $this->byName ("query"); - // $this->fail (); - // } - // catch (Exception $e) { - // } + $search = $this->byName ("query"); + $this->assertFalse ($search->displayed ()); - // $search = $this->byName ("query"); - // $this->assertFalse ($search->displayed ()); + $cog->click (); - // $cog->click (); - - // $search = $this->byName ("query"); - // $this->assertTrue ($search->displayed ()); + $search = $this->byName ("query"); + $this->assertTrue ($search->displayed ()); } } diff --git a/test/config_local.php.sauce b/test/config_local.php.sauce index 0818b69..7e3c310 100644 --- a/test/config_local.php.sauce +++ b/test/config_local.php.sauce @@ -12,6 +12,6 @@ /* * Catalog's title */ - $config['cops_title_default'] = "COPS"; + $config['cops_title_default'] = "COPS DEMO"; // $config['cops_server_side_render'] = "."; From 31954249b3316d0f6c09560fd3eeed23e5e8d254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Fri, 29 Nov 2013 11:46:10 +0100 Subject: [PATCH 63/70] Try paratest --- test/prepareSauceTest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index 61ff7e5..d4ce0b9 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -16,5 +16,5 @@ curl https://gist.github.com/seblucas/7692094/raw/e2a090e6ea639a0d700e6d02cee048 curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php cp -v test/config_local.php.sauce config_local.php php -S 127.0.0.1:8888 & -vendor/bin/phpunit --no-configuration test/Sauce.php +vendor/bin/paratest -p 3 -f --phpunit=vendor/bin/phpunit test/Sauce.php From 2f6676760f4872e6db340582a1cca53915abf301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Fri, 29 Nov 2013 15:35:12 +0100 Subject: [PATCH 64/70] Try to correctly set the home page. --- test/Sauce.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/Sauce.php b/test/Sauce.php index c07ec5d..db778eb 100644 --- a/test/Sauce.php +++ b/test/Sauce.php @@ -89,6 +89,14 @@ class Cops extends Sauce\Sausage\WebDriverTestCase } else { $this->url('http://cops-demo.slucas.fr/index.php'); } + + $driver = $this; + $title_test = function($value) use ($driver) { + $text = $driver->byXPath('//h1')->text (); + return $text == $value; + }; + + $this->spinAssert("Home Title", $title_test, [ "COPS DEMO" ]); } public function string_to_ascii($string) @@ -110,10 +118,7 @@ class Cops extends Sauce\Sausage\WebDriverTestCase $text = $driver->byXPath('//h1')->text (); return $text == $value; }; - - $this->spinAssert("Home Title", $title_test, [ "COPS DEMO" ]); - $author = $this->byXPath ('//h2[contains(text(), "Authors")]'); $author->click (); From 8b87e1672875ce43abcdabd0cf9657e0c710bf8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Fri, 29 Nov 2013 16:05:19 +0100 Subject: [PATCH 65/70] Return to phpunit. worked better --- test/prepareSauceTest.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index d4ce0b9..1b06ec9 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -16,5 +16,6 @@ curl https://gist.github.com/seblucas/7692094/raw/e2a090e6ea639a0d700e6d02cee048 curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php cp -v test/config_local.php.sauce config_local.php php -S 127.0.0.1:8888 & -vendor/bin/paratest -p 3 -f --phpunit=vendor/bin/phpunit test/Sauce.php +vendor/bin/phpunit --no-configuration test/Sauce.php + From 56647a44ebf9b899e4c0d007ba01632e8d33e3d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Sat, 30 Nov 2013 15:36:49 +0100 Subject: [PATCH 66/70] Change the link name for ebook download to be the book format (instead of download). Proposed by At Libitum. fix #119 --- book.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book.php b/book.php index 10237e7..a0e6c34 100644 --- a/book.php +++ b/book.php @@ -427,7 +427,7 @@ class Book extends Base { { if ($data->isKnownType ()) { - array_push ($linkArray, $data->getDataLink (Link::OPDS_ACQUISITION_TYPE, "Download")); + array_push ($linkArray, $data->getDataLink (Link::OPDS_ACQUISITION_TYPE, $data->format)); } } From 19baa9bdf502056d41b6d42d5407498836f238c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Sat, 30 Nov 2013 16:45:56 +0100 Subject: [PATCH 67/70] Fix some tabs :(. --- .htaccess | 2 +- base.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.htaccess b/.htaccess index d20a79d..38ac086 100644 --- a/.htaccess +++ b/.htaccess @@ -2,7 +2,7 @@ DirectoryIndex index.php - XSendFile on + XSendFile on diff --git a/base.php b/base.php index af57961..007b285 100644 --- a/base.php +++ b/base.php @@ -465,7 +465,7 @@ class Page if (!is_null ($series)) array_push ($this->entryArray, $series); $tags = Tag::getCount(); if (!is_null ($tags)) array_push ($this->entryArray, $tags); - $languages = Language::getCount(); + $languages = Language::getCount(); if (!is_null ($languages)) array_push ($this->entryArray, $languages); foreach ($config['cops_calibre_custom_column'] as $lookup) { $customId = CustomColumn::getCustomId ($lookup); From 268565882de7fa1d8532f9e9d7c8cd610af20bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Sat, 30 Nov 2013 16:56:37 +0100 Subject: [PATCH 68/70] Add a test to avoid testing on Sauce when the API KEY is not here ... (Pull request). --- test/prepareSauceTest.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index 1b06ec9..7b6a71b 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -1,5 +1,11 @@ #!/usr/bin/env bash +if [[ -z $SAUCE_API_KEY ]] + then + echo "No Sauce Api Key (Pull request)" + exit +fi + PHP_VERSION=`php -v|grep --only-matching --perl-regexp "PHP 5\.\\d+"` echo $PHP_VERSION From a4ba43d75e16e228b89ffcb9bfd938092fb98d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Sat, 30 Nov 2013 17:11:20 +0100 Subject: [PATCH 69/70] Horrible copy paste ... --- test/prepareSauceTest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/prepareSauceTest.sh b/test/prepareSauceTest.sh index 7b6a71b..5355c6e 100644 --- a/test/prepareSauceTest.sh +++ b/test/prepareSauceTest.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -if [[ -z $SAUCE_API_KEY ]] +if [[ -z $SAUCE_ACCESS_KEY ]] then echo "No Sauce Api Key (Pull request)" exit From 647ad06b448b1f52296e35f4562cf6685d7b4456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 2 Dec 2013 09:42:03 +0100 Subject: [PATCH 70/70] Add a proper documentation about having both authentication and working download on Sony PRS-TX. It could be better it will do for now. re #120 --- .htaccess | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.htaccess b/.htaccess index 38ac086..80f0908 100644 --- a/.htaccess +++ b/.htaccess @@ -61,6 +61,12 @@ ExpiresByType text/javascript "access plus 1 year" ########################################### # Uncomment if you wish to protect access with a password ########################################### +# If your covers and books are not available as soon as you protect it +# You can try replacing the FilesMatch directive by this one +# +# If helps for Sony PRS-TX and Aldiko, beware fetch.php can be accessed +# with authentication +########################################### # #AuthUserFile /path/to/file #AuthGroupFile /dev/null