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


PHP core_kernel_classes_Class::setLabel方法代码示例

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


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

示例1: 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


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