getRootClass(); $report = ImportService::singleton()->importQTIPACKFile(dirname(__FILE__) . '/samples/package/QTI/package.zip', $itemClass); $items = []; foreach ($report as $itemReport) { $data = $itemReport->getData(); if (!is_null($data)) { $items[] = $data; } } $this->assertEquals(1, count($items)); $item = current($items); $this->assertIsA($item, 'core_kernel_classes_Resource'); $this->assertTrue($item->exists()); $rm = new LocalItemSource(['item' => $item , 'lang' => DEFAULT_LANG]); $data = $rm->getDirectory(); $this->assertTrue(is_array($data)); $this->assertTrue(isset($data['path'])); $this->assertEquals('/', $data['path']); $this->assertTrue(isset($data['children'])); $children = $data['children']; $this->assertEquals(3, count($children)); $check = ['/images/','/style/']; $file = null; $dir = null; foreach ($children as $child) { if (isset($child['path'])) { $this->assertContains($child['path'], $check); } if (isset($child['name'])) { $file = $child; } } $this->assertEquals("qti.xml", $file['name']); $this->assertTrue(strpos($file['mime'], '/xml') !== false); //can be 'application/xml' or 'text/xml' $this->assertTrue($file['size'] > 0); taoItems_models_classes_ItemsService::singleton()->deleteItem($item); $this->assertFalse($item->exists()); } }