当前位置: 首页>>代码示例>>PHP>>正文


PHP core_kernel_classes_Class::delete方法代码示例

本文整理汇总了PHP中core_kernel_classes_Class::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP core_kernel_classes_Class::delete方法的具体用法?PHP core_kernel_classes_Class::delete怎么用?PHP core_kernel_classes_Class::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core_kernel_classes_Class的用法示例。


在下文中一共展示了core_kernel_classes_Class::delete方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tearDown

 public function tearDown()
 {
     foreach ($this->topClass->getInstances(true) as $instance) {
         $instance->delete();
     }
     foreach ($this->topClass->getSubClasses(true) as $subClass) {
         $subClass->delete();
     }
     $this->topClass->delete();
     $this->emptyClass->delete();
 }
开发者ID:nagyist,项目名称:generis,代码行数:11,代码来源:GenerisIteratorTest.php

示例2: clean

 public function clean()
 {
     $referencer = ResourceReferencer::singleton();
     $classProxy = ClassProxy::singleton();
     $switcher = new Switcher();
     // Remove the resources
     foreach ($this->targetSubjectClass->getInstances() as $instance) {
         $instance->delete();
         $this->assertFalse($referencer->isResourceReferenced($instance));
     }
     foreach ($this->targetSubjectSubClass->getInstances() as $instance) {
         $instance->delete();
         $this->assertFalse($referencer->isResourceReferenced($instance));
     }
     // delete the sub subject class (will be internally unhardified)
     $this->targetSubjectClass->delete(true);
     $this->assertFalse($referencer->isClassReferenced($this->targetSubjectClass));
     $this->assertIsA($classProxy->getImpToDelegateTo($this->targetSubjectClass), 'core_kernel_persistence_smoothsql_Class');
     // delete the sub sub subject class (will be internally unhardified)
     $this->targetSubjectSubClass->delete(true);
     $this->assertFalse($referencer->isClassReferenced($this->targetSubjectSubClass));
     $this->assertIsA($classProxy->getImpToDelegateTo($this->targetSubjectSubClass), 'core_kernel_persistence_smoothsql_Class');
     $this->assertTrue($this->targetWorkClass->delete(true));
     $this->assertTrue($this->targetMovieClass->delete(true));
     if ($this->targetSongClass != null) {
         $this->targetSongClass->delete(true);
     }
     //$this->assertFalse($referencer->isClassReferenced($this->targetWorkClass));
     //$this->assertFalse($referencer->isClassReferenced($this->targetMovieClass));
     //$this->assertFalse($referencer->isClassReferenced($this->targetSongClass));
     //$this->assertFalse($this->targetWorkClass->exists());
     //$this->assertFalse($this->targetWorkClass->exists());
     //$this->assertFalse($this->targetSongClass->exists());
 }
开发者ID:nagyist,项目名称:extension-generis-hard,代码行数:34,代码来源:HardImplTest.php

示例3: deleteClass

 /**
  * Delete a subclass
  *
  * @access public
  * @author Joel Bout, <joel@taotesting.com>
  * @param  Class clazz
  * @return boolean
  */
 public function deleteClass(core_kernel_classes_Class $clazz)
 {
     $returnValue = (bool) false;
     if ($clazz->isSubClassOf($this->getRootClass()) && !$clazz->equals($this->getRootClass())) {
         $returnValue = $clazz->delete();
     } else {
         common_Logger::w('Tried to delete class ' . $clazz->getUri() . ' as if it were a subclass of ' . $this->getRootClass()->getUri());
     }
     return (bool) $returnValue;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:18,代码来源:class.ClassService.php

示例4: delete

 /**
  * (non-PHPdoc)
  *
  * @see \oat\tao\model\media\MediaManagement::delete
  */
 public function delete($link)
 {
     $instance = new \core_kernel_classes_Class(\tao_helpers_Uri::decode($link));
     $fileLink = $instance->getUniquePropertyValue(new \core_kernel_classes_Property(MEDIA_LINK));
     $fileLink = $fileLink instanceof \core_kernel_classes_Resource ? $fileLink->getUri() : (string) $fileLink;
     $instance->delete();
     $fileManager = FileManager::getFileManagementModel();
     $deleted = $fileManager->deleteFile($fileLink);
     return $deleted;
 }
开发者ID:nagyist,项目名称:extension-tao-mediamanager,代码行数:15,代码来源:MediaSource.php

示例5: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     \taoItems_models_classes_ItemsService::singleton()->deleteItem(self::$itemResource);
     // Unregister Metadata ClassLookup.
     \oat\taoQtiItem\model\qti\Service::singleton()->getMetadataRegistry()->unregisterMetadataClassLookup('oat\\taoQtiItem\\model\\qti\\metadata\\classLookups\\LabelClassLookup');
     // Unregister Metadata Extractor.
     \oat\taoQtiItem\model\qti\Service::singleton()->getMetadataRegistry()->unregisterMetadataExtractor('oat\\taoQtiItem\\model\\qti\\metadata\\imsManifest\\ImsManifestMetadataExtractor');
     // Delete fake class
     $class = new \core_kernel_classes_Class('http://www.test.com#mytestclass');
     $class->delete(true);
 }
开发者ID:nagyist,项目名称:extension-tao-itemqti,代码行数:11,代码来源:LabelClassLookupTest.php

示例6: testInject

 public function testInject()
 {
     $generisClass = new core_kernel_classes_Class(CLASS_GENERIS_RESOURCE);
     $testClass = $generisClass->createSubClass();
     try {
         $testInstance = $testClass->createInstanceWithProperties(array(RDFS_LABEL => '"hi"'));
         $testInstance->setPropertiesValues(array(RDFS_COMMENT => '"hi"'));
         $this->assertEquals($testInstance->getUniquePropertyValue(new core_kernel_classes_Property(RDFS_LABEL)), "\"hi\"");
     } catch (PDOException $e) {
         $this->fail('SQL Error: ' . $e->getMessage());
     }
     $testInstance->delete();
     $generisClass->delete();
 }
开发者ID:nagyist,项目名称:generis,代码行数:14,代码来源:SqlInjectionTest.php

示例7: deleteClass

 /**
  * Delete a subclass
  *
  * @access public
  * @author Joel Bout, <joel@taotesting.com>
  * @param core_kernel_classes_Class $clazz            
  * @return boolean
  */
 public function deleteClass(core_kernel_classes_Class $clazz)
 {
     $returnValue = (bool) false;
     if ($clazz->isSubClassOf($this->getRootClass()) && !$clazz->equals($this->getRootClass())) {
         $returnValue = true;
         $subclasses = $clazz->getSubClasses(false);
         foreach ($subclasses as $subclass) {
             $returnValue = $returnValue && $this->deleteClass($subclass);
         }
         foreach ($clazz->getProperties() as $classProperty) {
             $returnValue = $returnValue && $this->deleteClassProperty($classProperty);
         }
         $returnValue = $returnValue && $clazz->delete();
     } else {
         common_Logger::w('Tried to delete class ' . $clazz->getUri() . ' as if it were a subclass of ' . $this->getRootClass()->getUri());
     }
     return (bool) $returnValue;
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:26,代码来源:class.ClassService.php

示例8: testGetDirectory

 public function testGetDirectory()
 {
     $root = new \core_kernel_classes_Class($this->rootClass);
     //Remove what has been done
     $subclasses = $root->getSubClasses();
     foreach ($subclasses as $subclass) {
         $subclass->delete(true);
     }
     $root->delete();
     $root->setLabel('myRootClass');
     $acceptableMime = array();
     $depth = 1;
     $directory = $this->mediaManagerManagement->getDirectory($this->rootClass, $acceptableMime, $depth);
     $this->assertInternalType('array', $directory, 'The result should be an array');
     $this->assertArrayHasKey('label', $directory, 'The result should contain "label"');
     $this->assertArrayHasKey('path', $directory, 'The result should contain "path"');
     $this->assertArrayHasKey('children', $directory, 'The result should contain "children"');
     $this->assertInternalType('array', $directory['children'], 'Children should be an array');
     $this->assertEmpty($directory['children'], 'Children should be empty');
     $this->assertEquals('myRootClass', $directory['label'], 'The label is not correct');
     $this->assertEquals('taomedia://mediamanager/' . \tao_helpers_Uri::encode($this->rootClass), $directory['path'], 'The path is not correct');
     $root->createSubClass('mySubClass1');
     $root->createSubClass('mySubClass0');
     $newDirectory = $this->mediaManagerManagement->getDirectory($this->rootClass, $acceptableMime, $depth);
     $this->assertInternalType('array', $newDirectory['children'], 'Children should be an array');
     $this->assertNotEmpty($newDirectory['children'], 'Children should not be empty');
     $labels = array();
     foreach ($newDirectory['children'] as $i => $child) {
         $this->assertInternalType('array', $child, 'The result should be an array');
         $this->assertArrayHasKey('label', $child, 'The result should contain "label"');
         $this->assertArrayHasKey('path', $child, 'The result should contain "path"');
         $labels[] = $child['label'];
     }
     $this->assertEquals(2, count($labels));
     $this->assertContains('mySubClass0', $labels);
     $this->assertContains('mySubClass1', $labels);
     //Remove what has been done
     $subclasses = $root->getSubClasses();
     foreach ($subclasses as $subclass) {
         $subclass->delete();
     }
     $root->delete();
 }
开发者ID:nagyist,项目名称:extension-tao-mediamanager,代码行数:43,代码来源:MediaManagerBrowserTest.php

示例9: testClearRoles

 public function testClearRoles()
 {
     $prefix = LOCAL_NAMESPACE . '#';
     $roleUris = array($prefix . 'baseRole', $prefix . 'subRole1', $prefix . 'subRole2', $prefix . 'subRole3', $prefix . 'subRole11', $prefix . 'subRole12', $prefix . 'subRole13');
     foreach ($roleUris as $ru) {
         $r = new core_kernel_classes_Class($ru);
         $r->delete(true);
         $this->assertFalse($r->exists());
     }
 }
开发者ID:nagyist,项目名称:generis,代码行数:10,代码来源:UserServiceTest.php

示例10: testCreateMediaInstance

 public function testCreateMediaInstance()
 {
     $fileTmp = dirname(__DIR__) . '/sample/Brazil.png';
     $this->initializeMock($fileTmp);
     $lang = 'EN-en';
     $classUri = $this->testClass->getUri();
     //clear previous tests
     $root = new \core_kernel_classes_Class($classUri);
     $link = $this->mediaService->createMediaInstance($fileTmp, $classUri, $lang);
     $root = new \core_kernel_classes_Class($classUri);
     $instances = $root->getInstances();
     /** @var \core_kernel_classes_Resource $instance */
     $instance = array_pop($instances);
     $thing = $instance->getUniquePropertyValue(new \core_kernel_classes_Property(MEDIA_LINK));
     $linkResult = $thing instanceof \core_kernel_classes_Resource ? $thing->getUri() : (string) $thing;
     $this->assertInstanceOf('\\core_kernel_classes_Resource', $instance, 'It should create an instance under the class in parameter');
     $this->assertEquals('Brazil.png', $instance->getLabel(), 'The instance label is wrong');
     $this->assertInternalType('string', $link, 'The method return should be a string');
     $this->assertEquals($instance->getUri(), $link, 'The instance link is wrong');
     $this->assertEquals($linkResult, 'MyGreatLink', 'The returned link is wrong');
     $this->assertEquals($lang, $instance->getUniquePropertyValue(new \core_kernel_classes_Property(MEDIA_LANGUAGE)), 'The instance language is wrong');
     $root->delete(true);
     $root->setSubClassOf($this->mediaService->getRootClass());
 }
开发者ID:nagyist,项目名称:extension-tao-mediamanager,代码行数:24,代码来源:MediaServiceTest.php


注:本文中的core_kernel_classes_Class::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。