/**
  * @depends testInstantiateClass
  * @param \core_kernel_classes_Resource $instance
  */
 public function testItemContent($instance)
 {
     $this->assertFalse($this->itemsService->hasItemModel($instance, array(OwiItemModel::ITEMMODEL_URI)));
     $this->assertFalse($this->itemsService->hasItemContent($instance));
     $this->itemsService->setDefaultItemContent($instance);
     $this->assertFileExists($this->itemsService->getDefaultItemFolder($instance));
     $instance->setPropertyValue(new \core_kernel_classes_Property(TAO_ITEM_MODEL_PROPERTY), OwiItemModel::ITEMMODEL_URI);
     //is really empty
     $this->assertFalse($this->itemsService->hasItemContent($instance));
     //we can set
     $this->assertNotNull($this->itemsService->setItemContent($instance, 'test'));
     $this->assertEquals('test', $this->itemsService->getItemContent($instance));
     //        and overwrite
     $this->assertNotNull($this->itemsService->setItemContent($instance, 'test2'));
     $this->assertEquals('test2', $this->itemsService->getItemContent($instance));
     //if no itemContent is set get the default one and copy it into a new repository
     $this->assertEquals('test2', $this->itemsService->getItemContent($instance, 'BY'));
     $this->assertTrue($this->itemsService->hasItemContent($instance));
     $this->assertStringStartsWith(LOCAL_NAMESPACE, $instance->getUri());
     $this->assertTrue($this->itemsService->hasItemModel($instance, array(OwiItemModel::ITEMMODEL_URI)));
     $this->assertStringStartsWith(ROOT_URL, $this->itemsService->getPreviewUrl($instance));
     $this->assertEquals('taoItems_models_classes_ItemCompiler', $this->itemsService->getCompilerClass($instance));
     $this->assertEquals(count($this->itemsService->getAllByModel($instance)), 0);
     $this->assertEquals(count($this->itemsService->getAllByModel(null)), 0);
     $this->assertContains('test2', $this->itemsService->render($instance, $this->itemsService->getSessionLg()));
     $this->assertFalse($this->itemsService->hasModelStatus($instance, array(TAO_ITEM_MODEL_STATUS_DEPRECATED)));
     $dataPath = FILES_PATH . 'taoItems' . DIRECTORY_SEPARATOR . 'itemData' . DIRECTORY_SEPARATOR;
     $source = \tao_models_classes_FileSourceService::singleton()->addLocalSource('itemDirectory', $dataPath);
     $this->assertNotFalse($this->itemsService->setDefaultFilesource($source));
 }
 /**
  * @depends testInstantiateClass
  * @param \core_kernel_classes_Resource $instance
  */
 public function testItemContent($instance)
 {
     $this->assertFalse($this->itemsService->hasItemModel($instance, array(ItemModel::MODEL_URI)));
     $this->assertFalse($this->itemsService->hasItemContent($instance));
     $instance->setPropertyValue(new \core_kernel_classes_Property(TAO_ITEM_MODEL_PROPERTY), ItemModel::MODEL_URI);
     $directory = $this->itemsService->getItemDirectory($instance);
     $this->assertTrue($directory->getFile('qti.xml')->write('test'));
     $this->assertTrue($this->itemsService->hasItemContent($instance));
     $this->assertStringStartsWith(LOCAL_NAMESPACE, $instance->getUri());
     $this->assertTrue($this->itemsService->hasItemModel($instance, array(ItemModel::MODEL_URI)));
     $this->assertStringStartsWith(ROOT_URL, $this->itemsService->getPreviewUrl($instance));
     $this->assertEquals('oat\\taoQtiItem\\model\\QtiItemCompiler', $this->itemsService->getCompilerClass($instance));
     $this->assertEquals(count($this->itemsService->getAllByModel($instance)), 0);
     $this->assertEquals(count($this->itemsService->getAllByModel(null)), 0);
     $this->assertFalse($this->itemsService->hasModelStatus($instance, array(TAO_ITEM_MODEL_STATUS_DEPRECATED)));
 }