本文整理汇总了PHP中PersistableFilter::hasSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP PersistableFilter::hasSetting方法的具体用法?PHP PersistableFilter::hasSetting怎么用?PHP PersistableFilter::hasSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PersistableFilter
的用法示例。
在下文中一共展示了PersistableFilter::hasSetting方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testInstantiationAndExecute
/**
* @covers PersistableFilter
*/
public function testInstantiationAndExecute()
{
$constructorArg = PersistableFilter::tempGroup('class::lib.pkp.tests.classes.filter.TestClass1', 'class::lib.pkp.tests.classes.filter.TestClass2');
$testFilter = new PersistableFilter($constructorArg);
// Test getters/setters that are not implicitly tested by other tests
self::assertInstanceOf('FilterGroup', $testFilter->getFilterGroup());
$testFilter->setDisplayName('Some other display name');
$testFilter->setIsTemplate(1);
self::assertTrue($testFilter->getIsTemplate());
self::assertEquals(0, $testFilter->getParentFilterId());
$testFilter->setParentFilterId(1);
self::assertEquals(1, $testFilter->getParentFilterId());
// Test settings
self::assertFalse($testFilter->hasSettings());
$testSetting = new EmailFilterSetting('testEmail', 'Test Email', 'Test Email is required');
$testSetting2 = new EmailFilterSetting('testEmail2', 'Test Email2', 'Test Email2 is required');
$testSetting2->setIsLocalized(true);
$testFilter->addSetting($testSetting);
$testFilter->addSetting($testSetting2);
self::assertEquals(array('testEmail' => $testSetting, 'testEmail2' => $testSetting2), $testFilter->getSettings());
self::assertTrue($testFilter->hasSettings());
self::assertEquals(array('testEmail'), $testFilter->getSettingNames());
self::assertEquals(array('testEmail2'), $testFilter->getLocalizedSettingNames());
self::assertTrue($testFilter->hasSetting('testEmail'));
self::assertEquals($testSetting, $testFilter->getSetting('testEmail'));
// Test type validation.
$typeDescriptionFactory = TypeDescriptionFactory::getInstance();
$inputTypeDescription = 'class::lib.pkp.tests.classes.filter.TestClass1';
$outputTypeDescription = 'class::lib.pkp.tests.classes.filter.TestClass2';
self::assertEquals($inputTypeDescription, $testFilter->getInputType()->getTypeDescription());
self::assertEquals($outputTypeDescription, $testFilter->getOutputType()->getTypeDescription());
}
示例2:
/**
* @see PersistableFilter::getSetting()
*/
function &getSetting($settingName)
{
// Try first whether we have the setting locally.
if (parent::hasSetting($settingName)) {
return parent::getSetting($settingName);
}
// Otherwise expect a mapped setting.
return $this->_getSubfilterSetting($settingName);
}