Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Commit

Permalink
Adds set up and add method test
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Paul committed Oct 21, 2016
1 parent d1522e2 commit 7401861
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/VaultTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
<?php

use CraigPaul\Moneris\Vault;
use CraigPaul\Moneris\CreditCard;

class VaultTest extends TestCase
{
/**
* @var \CraigPaul\Moneris\Vault
*/
protected $vault;

/**
* Set up the test environment.
*
* @return void
*/
public function setUp()
{
parent::setUp();

$this->vault = Vault::create($this->id, $this->token, $this->environment);
}

/** @test */
public function it_can_instantiate_via_the_constructor()
{
Expand All @@ -25,4 +43,16 @@ public function it_can_instantiate_via_a_static_create_method()
$this->assertObjectHasAttribute('token', $vault);
$this->assertObjectHasAttribute('environment', $vault);
}

/** @test */
public function it_can_add_a_credit_card_to_the_moneris_vault_and_returns_a_data_key_for_storage()
{
$card = CreditCard::create($this->visa, '2012');

$response = $this->vault->add($card);
$receipt = $response->receipt();

$this->assertTrue($response->successful);
$this->assertNotNull($receipt->DataKey);
}
}

0 comments on commit 7401861

Please sign in to comment.