Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve card model tests #77

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions test/Bitreserve/Tests/Unit/Model/CardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CardTest extends TestCase
*/
public function shouldReturnInstanceOfCard()
{
$data = array('id' => '1');
$data = array('id' => $this->faker->randomDigitNotNull);

$client = $this->getBitreserveClientMock();

Expand All @@ -24,12 +24,24 @@ public function shouldReturnInstanceOfCard()
$this->assertInstanceOf('Bitreserve\Model\Card', $card);
}

/**
* @test
*
* @expectedException PHPUnit_Framework_Error
* @expectedExceptionMessage Argument 1 passed to Bitreserve\Model\Card::__construct() must be an
* instance of Bitreserve\BitreserveClient, string given
*/
public function shouldThrowExceptionWhenFirstArgumentIsNotAnInstanceOfBitreserveClient()
{
$card = new Card('foo', 'bar');
}

/**
* @test
*/
public function shouldReturnId()
{
$data = array('id' => '1');
$data = array('id' => $this->faker->randomDigitNotNull);

$client = $this->getBitreserveClientMock();

Expand Down Expand Up @@ -57,7 +69,7 @@ public function shouldReturnAddress()
*/
public function shouldReturnLabel()
{
$data = array('label' => 'My Card');
$data = array('label' => $this->faker->sentence(3));

$client = $this->getBitreserveClientMock();

Expand All @@ -71,7 +83,7 @@ public function shouldReturnLabel()
*/
public function shouldReturnCurrency()
{
$data = array('currency' => 'BTC');
$data = array('currency' => $this->faker->currencyCode);

$client = $this->getBitreserveClientMock();

Expand All @@ -85,7 +97,7 @@ public function shouldReturnCurrency()
*/
public function shouldReturnBalance()
{
$data = array('balance' => '12.34');
$data = array('balance' => $this->faker->randomFloat);

$client = $this->getBitreserveClientMock();

Expand All @@ -99,7 +111,7 @@ public function shouldReturnBalance()
*/
public function shouldReturnAvailable()
{
$data = array('available' => '12.34');
$data = array('available' => $this->faker->randomFloat);

$client = $this->getBitreserveClientMock();

Expand Down Expand Up @@ -127,7 +139,7 @@ public function shouldReturnLastTransactionAt()
*/
public function shouldReturnSettings()
{
$data = array('settings' => array('position' => '3', 'starred' => true));
$data = array('settings' => array('position' => $this->faker->randomDigitNotNull, 'starred' => true));

$client = $this->getBitreserveClientMock();

Expand Down Expand Up @@ -196,10 +208,10 @@ public function shouldCreateNewTransaction()
$cardData = array('id' => 'ade869d8-7913-4f67-bb4d-72719f0a2be0');

$postData = array(
'destination' => 'luke.skywalker@rebelalliance.org',
'destination' => $this->faker->email,
'denomination' => array(
'amount' => '0.1',
'currency' => 'BTC',
'amount' => $this->faker->randomFloat,
'currency' => $this->faker->currencyCode,
));

$data = array(
Expand Down
4 changes: 3 additions & 1 deletion test/Bitreserve/Tests/Unit/Model/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

namespace Bitreserve\Tests\Unit\Model;

use Bitreserve\Tests\Unit\TestCase as BaseTestCase;

/**
* TestCase.
*/
abstract class TestCase extends \PHPUnit_Framework_TestCase
abstract class TestCase extends BaseTestCase
{
/**
* Get Model class.
Expand Down