From 05ea8216ff67dc90d3b18c4014b7305d814a2fa0 Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 1 Jan 2015 22:51:38 +0100 Subject: [PATCH] Fixed transaction coverage. --- app/tests/factories/Transaction.php | 4 +++- composer.json | 4 +++- composer.lock | 2 +- tests/unit/TransactionTest.php | 7 +++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/tests/factories/Transaction.php b/app/tests/factories/Transaction.php index 42b056a423..9f812b8ce0 100644 --- a/app/tests/factories/Transaction.php +++ b/app/tests/factories/Transaction.php @@ -5,6 +5,8 @@ League\FactoryMuffin\Facade::define( 'account_id' => 'factory|Account', 'transaction_journal_id' => 'factory|TransactionJournal', 'description' => 'sentence', - 'amount' => 'numberBetween:1,100', + 'amount' => function() { + return round(rand(100,10000) / 100,2); + } ] ); diff --git a/composer.json b/composer.json index a1d3a88366..7081b40e81 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,9 @@ "sebastian/phpdcd": "*", "codeception/phpbuiltinserver": "*", "codeception/specify": "*", - "codeception/verify": "*" + "codeception/verify": "*", + "fzaninotto/faker": "1.*" + }, "autoload": { diff --git a/composer.lock b/composer.lock index 084857beb1..e419de84ae 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "66a93b738537ed20455648f477585c88", + "hash": "3ac71ef711586f9c2bf7c36482284a13", "packages": [ { "name": "classpreloader/classpreloader", diff --git a/tests/unit/TransactionTest.php b/tests/unit/TransactionTest.php index 3d89e735c5..b571dccbb2 100644 --- a/tests/unit/TransactionTest.php +++ b/tests/unit/TransactionTest.php @@ -46,16 +46,15 @@ class TransactionTest extends TestCase { $transaction = f::create('Transaction'); $amount = floatval($transaction->amount); - $amount--; - $this->assertCount(1, Transaction::moreThan($amount)->get()); + $amount++; + $this->assertCount(1, Transaction::lessThan($amount)->get()); } public function testMoreThan() { $transaction = f::create('Transaction'); $amount = floatval($transaction->amount); - $amount++; - + $amount--; $this->assertCount(1, Transaction::moreThan($amount)->get()); }