本文整理汇总了PHP中app\models\City::setState方法的典型用法代码示例。如果您正苦于以下问题:PHP City::setState方法的具体用法?PHP City::setState怎么用?PHP City::setState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\City
的用法示例。
在下文中一共展示了City::setState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetGetState
public function testSetGetState()
{
$this->object->setState('state');
$this->assertEquals('state', $this->object->getState());
$this->object->setState('State');
$this->assertEquals('State', $this->object->getState());
}
示例2: testShouldUpdateCurrentLocation
public function testShouldUpdateCurrentLocation()
{
$currentLocation = null;
$latitude = -23.48033;
$longitude = -46.63459;
$city = new City();
$city->setName("São Paulo");
$city->setState("SP");
$address = new Address();
$address->setCity($city);
$address->setStreet("Rua Funchal");
$address->setDistrict("Vila Olímpia");
$api = $this->getMock("ApontadorApi", array("revgeocode"));
$api->expects($this->once())->method("revgeocode")->with($latitude, $longitude)->will($this->returnValue($address));
$locationController = new LocationController();
$locationController->setApi($api);
$locationController->disableSession();
$locationController->update($latitude, $longitude);
$current = $locationController->current();
$currentLocation = new Location($current['location']);
$this->assertNotNull($currentLocation);
$this->assertSame("SP", $currentLocation->getAddress()->getCity()->getState());
$this->assertSame("São Paulo", $currentLocation->getAddress()->getCity()->getName());
$this->assertSame("Vila Olímpia", $currentLocation->getAddress()->getDistrict());
$this->assertSame("Rua Funchal", $currentLocation->getAddress()->getStreet());
$this->assertSame($latitude, $currentLocation->getPoint()->getLat());
$this->assertSame($longitude, $currentLocation->getPoint()->getLng());
}
示例3: load
public function load()
{
$this->populate(unserialize(Session::read('location')));
$lat = $this->point->getLat();
$lng = $this->point->getLng();
if (empty($lat) || empty($lng)) {
$city = new City();
$city->setName("São Paulo");
$city->setState("SP");
$this->point->setLat(-23.48033);
$this->point->setLng(-46.63459);
$this->address->setCity($city);
}
}