本文整理汇总了PHP中Addresses::setBilling方法的典型用法代码示例。如果您正苦于以下问题:PHP Addresses::setBilling方法的具体用法?PHP Addresses::setBilling怎么用?PHP Addresses::setBilling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Addresses
的用法示例。
在下文中一共展示了Addresses::setBilling方法的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);
}