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


PHP Addresses::setShipping方法代码示例

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


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

示例1: testAddresses

 public function testAddresses()
 {
     $userId = 33;
     $address1 = new Address();
     $address1->user_id = $userId;
     $address1->organization = 'Microsoft Corporation';
     $address1->street = 'One Microsoft Way';
     $address1->city = 'Redmond';
     $address1->state = 'WA';
     $address1->zip = '98052-7329';
     $address1->phone = '(425) 882-8080';
     $this->assertTrue($address1->save());
     $this->assertEmpty(\Addresses::getPrimary($userId));
     $this->assertEmpty(\Addresses::getBilling($userId));
     $this->assertEmpty(\Addresses::getShipping($userId));
     $address2 = new Address();
     $address2->user_id = $userId;
     $address2->street = '1600 Pennsylvania Ave NW';
     $address2->city = 'Washington';
     $address2->state = 'DC';
     $address2->zip = '20500';
     $this->assertTrue($address2->save());
     $address3 = new Address();
     $address3->user_id = $userId;
     $address3->street = '501 Marlins Way';
     $address3->city = 'Miami';
     $address3->state = 'FLoridA';
     $address3->zip = '33125';
     $address3->country = 'United States';
     $this->assertTrue($address3->save());
     $this->assertEquals('US', $address3->country);
     $this->assertEquals('United States', $address3->country_name);
     $this->assertEquals('FL', $address3->state);
     $this->assertEquals('Florida', $address3->state_name);
     $address4 = new Address();
     $address4->user_id = 999999;
     $address4->street = '451 Test Street.';
     $address4->city = 'Salt Lake City';
     $address4->state = 'UT';
     $address4->zip = '84111';
     $this->assertTrue($address4->save());
     $all = Addresses::getAll($userId);
     $this->assertContainsOnlyInstancesOf('Conner\\Addresses\\Address', $all);
     $this->assertCount(3, $all);
     Addresses::setPrimary($address3);
     $this->assertEquals($address3->id, \Addresses::getPrimary($userId)->id);
     Addresses::setPrimary($address1);
     $this->assertNotEquals($address3->id, \Addresses::getPrimary($userId)->id);
     Addresses::setBilling($address2);
     $this->assertEquals($address2->id, \Addresses::getBilling($userId)->id);
     Addresses::setBilling($address1);
     $this->assertNotEquals($address2->id, \Addresses::getBilling($userId)->id);
     Addresses::setShipping($address3);
     $this->assertEquals($address3->id, \Addresses::getShipping($userId)->id);
     Addresses::setShipping($address1->id);
     $this->assertNotEquals($address2->id, \Addresses::getShipping($userId)->id);
     $html = '<span><em>' . \Addresses::getShipping($userId)->toHtml('</em><em>') . '</em></span>';
     $matcher = array('tag' => 'span', 'children' => array('greater_than' => 3, 'only' => array('tag' => 'em')));
     $this->assertTag($matcher, $html);
 }
开发者ID:declum,项目名称:laravel-addresses,代码行数:60,代码来源:AddressesTest.php


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