本文整理汇总了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();
}