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


PHP CMTest_TH::createLocation方法代码示例

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


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

示例1: testSetValueByEnvironment

 public function testSetValueByEnvironment()
 {
     $location = CMTest_TH::createLocation();
     $locationCity = $location->get(CM_Model_Location::LEVEL_CITY);
     $environment = new CM_Frontend_Environment();
     $environment->setLocation(null);
     $field = new CM_FormField_Location();
     $field->setValueByEnvironment($environment);
     $this->assertNull($field->getValue());
     $environment->setLocation($location->get(CM_Model_Location::LEVEL_COUNTRY));
     $field = new CM_FormField_Location(['levelMin' => CM_Model_Location::LEVEL_CITY]);
     $field->setValueByEnvironment($environment);
     $this->assertNull($field->getValue());
     $environment->setLocation($location);
     $field = new CM_FormField_Location(['levelMin' => CM_Model_Location::LEVEL_CITY, 'levelMax' => CM_Model_Location::LEVEL_CITY]);
     $field->setValueByEnvironment($environment);
     $value = $field->getValue();
     /** @var CM_Model_Location $locationValue */
     $locationValue = $value[0];
     $this->assertSame($locationCity->getId(), $locationValue->getId());
     $this->assertSame($locationCity->getLevel(), $locationValue->getLevel());
     $environment->setLocation($locationCity);
     $field = new CM_FormField_Location(['levelMin' => CM_Model_Location::LEVEL_CITY, 'levelMax' => CM_Model_Location::LEVEL_CITY]);
     $field->setValueByEnvironment($environment);
     $value = $field->getValue();
     /** @var CM_Model_Location $locationValue */
     $locationValue = $value[0];
     $this->assertSame($locationCity->getId(), $locationValue->getId());
     $this->assertSame($locationCity->getLevel(), $locationValue->getLevel());
 }
开发者ID:cargomedia,项目名称:cm,代码行数:30,代码来源:LocationTest.php

示例2: setUp

 public function setUp()
 {
     $smarty = new Smarty();
     $this->_render = new CM_Frontend_Render();
     $this->_template = $smarty->createTemplate('string:');
     $this->_template->assignGlobal('render', $this->_render);
     $this->_location = CMTest_TH::createLocation();
 }
开发者ID:cargomedia,项目名称:cm,代码行数:8,代码来源:function.locationTest.php

示例3: testProcessHostRedirect_parameter

 public function testProcessHostRedirect_parameter()
 {
     $site = CM_Site_Abstract::factory();
     $location = CMTest_TH::createLocation();
     $locationEncoded = CM_Params::encode($location, true);
     $query = http_build_query(['location' => $locationEncoded]);
     $response = CMTest_TH::createResponsePage('/mock5?' . $query, array('host' => 'incorrect-host.org'));
     $response->process();
     $siteUrl = 'http://' . $site->getHost();
     $this->assertContains('Location: ' . $siteUrl . '/mock5?' . $query, $response->getHeaders());
 }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:11,代码来源:PageTest.php

示例4: testProcessLanguageRedirect_parameter

 public function testProcessLanguageRedirect_parameter()
 {
     CMTest_TH::createLanguage('en');
     $viewer = CMTest_TH::createUser();
     $location = CMTest_TH::createLocation();
     $locationEncoded = CM_Params::encode($location, true);
     $query = http_build_query(['location' => $locationEncoded]);
     $site = CM_Site_Abstract::factory();
     $request = new CM_Http_Request_Get('/en/mock5?' . $query, ['host' => $site->getHost()], null, $viewer);
     $response = CM_Http_Response_Page::createFromRequest($request, $site, $this->getServiceManager());
     $response->process();
     $siteUrl = $response->getSite()->getUrl();
     $this->assertContains('Location: ' . $siteUrl . '/mock5?' . $query, $response->getHeaders());
 }
开发者ID:cargomedia,项目名称:cm,代码行数:14,代码来源:PageTest.php

示例5: 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());
     }
 }
开发者ID:cargomedia,项目名称:cm,代码行数:14,代码来源:ParamsTest.php

示例6: testArrayConvertible

 public function testArrayConvertible()
 {
     $location = CMTest_TH::createLocation();
     $this->assertEquals($location, CM_Model_Location::fromArray($location->toArray()));
 }
开发者ID:cargomedia,项目名称:cm,代码行数:5,代码来源:LocationTest.php


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