public function testInstantiateValidRegion() { $o = Merchant::order('England'); $this->assertInstanceOf('PhilipBrown\\Merchant\\Order', $o); $this->assertInstanceOf('PhilipBrown\\Merchant\\RegionInterface', $o->region); $this->assertEquals('England', $o->region); $this->assertEquals('GBP', $o->region->currency); $this->assertTrue($o->region->tax); $this->assertEquals(20, $o->region->tax_rate); }
public function testRandomData() { $o = Merchant::order('England'); $o->add('123', 1000); $o->add('456', 200, array('freebie' => true)); $o->add('789', 2000, array('discount' => 500)); $o->add('101112', 1000, array('taxable' => false)); $this->assertEquals(4200, $o->total_value->cents); $this->assertEquals(500, $o->total_discount->cents); $this->assertEquals(500, $o->total_tax->cents); $this->assertEquals(4000, $o->subtotal->cents); $this->assertEquals(4000, $o->total->cents); }
/** * @expectedException PhilipBrown\Merchant\Exception\InvalidProductException * @expectedExceptionMessage The coupon property must be a string */ public function testFreebieMustBeAString() { $o = Merchant::order('England'); $o->add('123', 1000, array('coupon' => array())); }