本文整理汇总了PHP中material::containsTag方法的典型用法代码示例。如果您正苦于以下问题:PHP material::containsTag方法的具体用法?PHP material::containsTag怎么用?PHP material::containsTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类material
的用法示例。
在下文中一共展示了material::containsTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTagCollection
public function testTagCollection()
{
$material = new material();
$this->assertFalse($material->containsTag('t'));
$material->addTag('t');
$this->assertTrue($material->containsTag('t'));
$material->removeTag('t');
$this->assertFalse($material->containsTag('t'));
//Repeat Tag
$this->assertFalse($material->containsTag('t'));
$material->addTag('t');
$material->addTag('t');
$this->assertTrue($material->containsTag('t'));
$material->removeTag('t');
$this->assertFalse($material->containsTag('t'));
$this->assertFalse($material->removeTag('t'));
//containsAllTag and containsAnyTag
$material->addTag('t1');
$material->addTag('t2');
$material->addTag('t3');
$this->assertTrue($material->containsAnyTag(array('t0', 't2')));
$this->assertTrue($material->containsAnyTag(array('t2', 't3')));
$this->assertFalse($material->containsAnyTag(array('t0', 't4')));
$this->assertTrue($material->containsAllTags(array('t1', 't2')));
$this->assertTrue($material->containsAllTags(array('t1')));
$this->assertFalse($material->containsAllTags(array('t0', 't2')));
$this->assertFalse($material->containsAllTags(array('t0', 't1', 't2', 't3')));
}