/** * @covers ::getBilling * @covers ::setBilling */ public function testBilling() { $item = new Purchase(); $billing = $item->getBilling(); $this->assertInstanceOf('CL\\Purchases\\Address', $billing); $this->assertTrue($billing->isVoid()); $billing = new Address(); $item->setBilling($billing); $this->assertSame($billing, $item->getBilling()); }
public function testStorePurchase() { $purchase = new Purchase(); $address = Address::find(1); $product1 = Product::find(5); $product2 = Product::find(6); $product3 = Product::find(7); $purchase->setBilling($address); $purchase->addProduct($product1, 4)->addProduct($product2)->addProduct($product3)->addProduct($product1); Purchase::save($purchase); $gateway = Omnipay::getFactory()->create('Dummy'); $parameters = ['card' => ['number' => '4242424242424242', 'expiryMonth' => 12, 'expiryYear' => date('Y'), 'cvv' => 123], 'clientIp' => '192.168.0.1']; $response = $purchase->purchase($gateway, $parameters); $this->assertTrue($response->isSuccessful()); $this->assertEquals('Success', $response->getMessage()); }