From 3368a26b2eccde2fb802ab20a08808bf1a7c53c2 Mon Sep 17 00:00:00 2001 From: jygaulier Date: Tue, 20 Nov 2012 17:21:34 +0100 Subject: [PATCH 1/4] fix rewriterule --- www/.htaccess | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/www/.htaccess b/www/.htaccess index b6945a2a29..709cf16ce2 100644 --- a/www/.htaccess +++ b/www/.htaccess @@ -1,9 +1,9 @@ RewriteEngine on - RewriteRule ^include/minify/([a-z]=.*) /include/minify/index.php?$1 [L,NE] + RewriteRule ^include/minify/([a-z]=.*) /include/minify/index.ph?$1 [L,NE] - RewriteRule ^lightbox/.?$ /index.php [L] - RewriteRule ^admin/.?$ /index.php [L] + RewriteRule ^lightbox/.*$ /index.php [L] + RewriteRule ^admin/.*$ /index.php [L] RewriteRule ^permalink/.*$ /index.php [L] RewriteRule ^datafiles/.*$ /index.php [L] RewriteRule ^robots.txt$ /index.php [L] @@ -25,7 +25,7 @@ RewriteRule ^prod/push/.*$ /index.php [L] RewriteRule ^prod/printer/.*$ /index.php [L] RewriteRule ^prod/story/.*$ /index.php [L] - RewriteRule ^prod/TOU/.?$ /index.php [L] + RewriteRule ^prod/TOU/.*$ /index.php [L] RewriteRule ^prod/WorkZone/.*$ /index.php [L] RewriteRule ^prod/language/.*$ /index.php [L] RewriteRule ^prod/tools/.*$ /index.php [L] From ed51d4d96825c3b8b767e488795c7c93565e8cf8 Mon Sep 17 00:00:00 2001 From: jygaulier Date: Wed, 16 Jan 2013 11:57:21 +0100 Subject: [PATCH 2/4] fix #1073 #1074 --- lib/classes/databox.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/classes/databox.class.php b/lib/classes/databox.class.php index 0b5beffafa..45720246ba 100644 --- a/lib/classes/databox.class.php +++ b/lib/classes/databox.class.php @@ -977,8 +977,8 @@ class databox extends base $dom = new DOMDocument(); - if ($thesaurus && false !== $tmp = $dom->loadXML($thesaurus)) { - self::$_dom_thesaurus[$sbas_id] = $tmp; + if ($thesaurus && false !== ($dom->loadXML($thesaurus))) { + self::$_dom_thesaurus[$sbas_id] = $dom; } else { self::$_dom_thesaurus[$sbas_id] = false; unset($dom); From 6c4d6af17ff796ef21aed29927d75e7e5e46b209 Mon Sep 17 00:00:00 2001 From: jygaulier Date: Thu, 17 Jan 2013 10:48:01 +0100 Subject: [PATCH 3/4] removed extra parenthesis --- lib/classes/databox.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/classes/databox.class.php b/lib/classes/databox.class.php index 45720246ba..4faab5754b 100644 --- a/lib/classes/databox.class.php +++ b/lib/classes/databox.class.php @@ -977,7 +977,7 @@ class databox extends base $dom = new DOMDocument(); - if ($thesaurus && false !== ($dom->loadXML($thesaurus))) { + if ($thesaurus && false !== $dom->loadXML($thesaurus)) { self::$_dom_thesaurus[$sbas_id] = $dom; } else { self::$_dom_thesaurus[$sbas_id] = false; From 25c4c76a24d20b9317cb8acafb96099fb12841ec Mon Sep 17 00:00:00 2001 From: jygaulier Date: Thu, 17 Jan 2013 14:51:29 +0100 Subject: [PATCH 4/4] added some tests for thesaurus/cterms --- .../Phrasea/Controller/Admin/DataboxTest.php | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/tests/Alchemy/Phrasea/Controller/Admin/DataboxTest.php b/tests/Alchemy/Phrasea/Controller/Admin/DataboxTest.php index 160dd8ecc8..26c8b20478 100644 --- a/tests/Alchemy/Phrasea/Controller/Admin/DataboxTest.php +++ b/tests/Alchemy/Phrasea/Controller/Admin/DataboxTest.php @@ -644,4 +644,80 @@ class DataboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->fail('Task for empty collection has not been created'); } } + + /** + * @covers \Alchemy\Phrasea\Controller\Admin\Database::saveThesaurus + * @covers \Alchemy\Phrasea\Controller\Admin\Database::get_thesaurus + * @covers \Alchemy\Phrasea\Controller\Admin\Database::get_dom_thesaurus + */ + public function test_get_thesaurus() + { + $testValue = rand(1000, 9999); + $xmlth = "\n" + . "" + . "" + . "\n"; + + $dom = new DOMDocument('1.0', 'UTF-8'); + $dom->loadXML($xmlth); + + $databox = $this->createDatabox(); + $databox->saveThesaurus($dom); + + // get back as xml text + $newxml = $databox->get_thesaurus(); + // xml must be ok + $this->assertTrue($dom->loadXML($newxml)); + // xml must match but with updated date + $this->assertTrue("20100101000000" != $dom->documentElement->getAttribute("modification_date")); + // check xml was saved + $this->assertTrue($testValue == $dom->documentElement->firstChild->getAttribute("value")); + + // get back as dom + $newdom = $databox->get_dom_thesaurus(); + $this->assertTrue("20100101000000" != $newdom->documentElement->getAttribute("modification_date")); + $this->assertTrue($testValue == $newdom->documentElement->firstChild->getAttribute("value")); + + /** + * @todo : check results with bad thesaurus + */ + } + + /** + * @covers \Alchemy\Phrasea\Controller\Admin\Database::saveCterms + * @covers \Alchemy\Phrasea\Controller\Admin\Database::get_cterms + * @covers \Alchemy\Phrasea\Controller\Admin\Database::get_dom_cterms + */ + public function test_get_cterms() + { + $testValue = rand(1000, 9999); + $xmlth = "\n" + . "" + . "" + . "\n"; + + $dom = new DOMDocument('1.0', 'UTF-8'); + $dom->loadXML($xmlth); + + $databox = $this->createDatabox(); + $databox->saveCterms($dom); + + // get back as xml text + $newxml = $databox->get_cterms(); + // xml must be ok + $this->assertTrue($dom->loadXML($newxml)); + // xml must match but with updated date + $this->assertTrue("20100101000000" != $dom->documentElement->getAttribute("modification_date")); + // check xml was saved + $this->assertTrue($testValue == $dom->documentElement->firstChild->getAttribute("value")); + + // get back as dom + $newdom = $databox->get_dom_cterms(); + $this->assertTrue("20100101000000" != $newdom->documentElement->getAttribute("modification_date")); + $this->assertTrue($testValue == $newdom->documentElement->firstChild->getAttribute("value")); + + /** + * @todo : check results with bad cterms + */ + } }