本文整理匯總了PHP中CM_Params::getLocation方法的典型用法代碼示例。如果您正苦於以下問題:PHP CM_Params::getLocation方法的具體用法?PHP CM_Params::getLocation怎麽用?PHP CM_Params::getLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CM_Params
的用法示例。
在下文中一共展示了CM_Params::getLocation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testGetLocation
public function testGetLocation()
{
$location = CMTest_TH::createLocation();
$params = new CM_Params(['location' => $location, 'locationParameters' => ['id' => $location->getId(), 'level' => $location->getLevel()], 'insufficientParameters' => 1]);
$this->assertEquals($location, $params->getLocation('location'));
$this->assertEquals($location, $params->getLocation('locationParameters'));
try {
$params->getLocation('insufficientParameters');
$this->fail('Instantiating location with insufficient parameters');
} catch (CM_Exception_InvalidParam $ex) {
$this->assertSame('Not enough parameters', $ex->getMessage());
$this->assertSame(['parameters' => 1, 'className' => 'CM_Model_Location'], $ex->getMetaInfo());
}
}