public function testUpdateTrue() { $itemRootDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('ItemUpdateInlineFeedbackTest') . DIRECTORY_SEPARATOR; $originalRootDir = realpath(ROOT_PATH . 'taoQtiItem/test/update/samples/itemData'); tao_helpers_File::copy($originalRootDir, $itemRootDir); $itemUpdater = new ItemUpdateInlineFeedback($itemRootDir); //test file modification $itemUpdater->update(true); $checkedFiles = $itemUpdater->getCheckedFiles(); $modifiedFiles = array_keys(array_filter($checkedFiles, function ($v) { return $v; })); $this->assertEquals(19, count($checkedFiles)); $this->assertEquals(2, count($modifiedFiles)); sort($modifiedFiles); $this->assertEquals(realpath($modifiedFiles[0]), realpath($itemRootDir . '/i1452699358831159_hasModal_willChange/itemContent/en-US/qti.xml')); $this->assertEquals(realpath($modifiedFiles[1]), realpath($itemRootDir . '/i1452759848383063_hasModal_willChange/itemContent/en-US/qti.xml')); //compare the content of the items after update $resultFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . 'updateResult.xml'; $resultFileContent = file_get_contents($resultFile); $resultFileContent = $this->normalizeXmlStrings($resultFileContent); $this->assertEquals($resultFileContent, $this->normalizeXmlStrings(file_get_contents($modifiedFiles[0]))); $this->assertEquals($resultFileContent, $this->normalizeXmlStrings(file_get_contents($modifiedFiles[1]))); }