mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 20:43:25 +00:00
Merge pull request #286 from jygaulier/fix_1073_1074
[3.8] Fix 1073 1074
This commit is contained in:
@@ -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);
|
||||
|
@@ -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 = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
|
||||
. "<thesaurus version=\"2.0.5\" creation_date=\"20100101000000\" modification_date=\"20100101000000\" nextid=\"4\">"
|
||||
. "<testnode value=\"" . $testValue . "\"/>"
|
||||
. "</thesaurus>\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 = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
|
||||
. "<cterms version=\"2.0.5\" creation_date=\"20100101000000\" modification_date=\"20100101000000\" nextid=\"4\">"
|
||||
. "<testnode value=\"" . $testValue . "\"/>"
|
||||
. "</cterms>\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
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
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]
|
||||
|
Reference in New Issue
Block a user