Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove tests subdirectory #858

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'label' => 'QTI test model',
'description' => 'TAO QTI test implementation',
'license' => 'GPL-2.0',
'version' => '17.21.4',
'version' => '17.21.5',
'author' => 'Open Assessment Technologies',
'requires' => array(
'taoTests' => '>=6.7.0',
Expand Down
23 changes: 15 additions & 8 deletions models/classes/export/class.QtiTestExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ protected function exportItems()
$file = $this->getTestService()->getQtiTestFile($this->getItem());
$extraPath = str_replace('\\', '/', dirname($rootDir->getRelPath($file)));
$extraPath = trim($extraPath, '/');

$extraReversePath = '';
$extraReversePath = '../../';
if (empty($extraPath) === false) {
$n = count(explode('/', $extraPath));
$parts = array();
Expand All @@ -244,7 +243,7 @@ protected function exportItems()
}

// Modify the reference to the item in the test definition.
$newQtiItemXmlPath = $extraReversePath . '../../items/' . tao_helpers_Uri::getUniqueId($item->getUri()) . '/qti.xml';
$newQtiItemXmlPath = $extraReversePath . 'items/' . tao_helpers_Uri::getUniqueId($item->getUri()) . '/qti.xml';
$itemRef = $this->getTestDocument()->getDocumentComponent()->getComponentByIdentifier($refIdentifier);
$itemRef->setHref($newQtiItemXmlPath);

Expand Down Expand Up @@ -274,23 +273,31 @@ protected function exportTest(array $itemIdentifiers)

$newTestDir = 'tests/' . tao_helpers_Uri::getUniqueId($this->getItem()->getUri()).'/';
$testRootDir = $this->getTestService()->getQtiTestDir($this->getItem());
$file = $this->getTestService()->getQtiTestFile($this->getItem());
// revert backslashes introduced by dirname on windows
$relPath = trim(str_replace('\\', '/',dirname($testRootDir->getRelPath($file))), '/');
$testHref = $newTestDir . (empty($relPath) ? '' : $relPath.'/') . 'test.xml';

$testHref = $newTestDir . 'test.xml';

common_Logger::t('TEST DEFINITION AT: ' . $testHref);
$this->getZip()->addFromString($testHref, $testXmlDocument);
$this->referenceTest($testHref, $itemIdentifiers);

$iterator = $testRootDir->getFlyIterator(Directory::ITERATOR_RECURSIVE|Directory::ITERATOR_FILE);
$indexFile = pathinfo(taoQtiTest_models_classes_QtiTestService::QTI_TEST_DEFINITION_INDEX , PATHINFO_BASENAME);
/**
* @var oat\oatbox\filesystem\File $f
*/
$file = $this->getTestService()->getQtiTestFile($this->getItem());
// revert backslashes introduced by dirname on windows
$relPath = trim(str_replace('\\', '/',dirname($testRootDir->getRelPath($file))), '/');
$basePath = $testRootDir->getPrefix();

foreach ($iterator as $f) {

// Only add dependency files...
if ($f->getBasename() !== taoQtiTest_models_classes_QtiTestService::TAOQTITEST_FILENAME && $f->getBasename() !== $indexFile) {

$data = $f->getMetadata();
// Add the file to the archive.
$fileHref = $newTestDir . ltrim($testRootDir->getRelPath($f), '/');
$fileHref = $newTestDir . ltrim(str_replace($basePath , '' , $data['path']), '/');
common_Logger::t('AUXILIARY FILE AT: ' . $fileHref);
$this->getZip()->addFromString($fileHref, $f->read());
$this->referenceAuxiliaryFile($fileHref);
Expand Down
3 changes: 2 additions & 1 deletion scripts/update/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,7 @@ public function update($initialVersion) {
$this->setVersion('17.19.0');
}

$this->skip('17.19.0', '17.21.4');
$this->skip('17.19.0', '17.21.5');

}
}