diff --git a/lib/classes/databox.class.php b/lib/classes/databox.class.php index 8b4c9c4048..85e1a5b6c5 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); diff --git a/tests/Alchemy/Phrasea/Controller/Admin/DataboxTest.php b/tests/Alchemy/Phrasea/Controller/Admin/DataboxTest.php index 29e1b18603..fbde6e2ed4 100644 --- a/tests/Alchemy/Phrasea/Controller/Admin/DataboxTest.php +++ b/tests/Alchemy/Phrasea/Controller/Admin/DataboxTest.php @@ -645,4 +645,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 + */ + } } 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]