Skip to content

Firefly III: a personal finances manager

First two tests for bill repository.

James Cole6802f0403600
diff --git a/tests/repositories/BillRepositoryTest.php b/tests/repositories/BillRepositoryTest.php
index 882bdac903..c900499a20 100644
--- a/tests/repositories/BillRepositoryTest.php
+++ b/tests/repositories/BillRepositoryTest.php
@@ -1,5 +1,8 @@
<?php
+use Carbon\Carbon;
+use FireflyIII\Models\Bill;
use FireflyIII\Repositories\Bill\BillRepository;
+use League\FactoryMuffin\Facade as FactoryMuffin;
/**
* Generated by PHPUnit_SkeletonGenerator on 2015-05-08 at 10:43:42.
@@ -32,26 +35,32 @@ class BillRepositoryTest extends TestCase
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::createFakeBill
- * @todo Implement testCreateFakeBill().
*/
public function testCreateFakeBill()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $description = 'Fake bill ' . rand(10, 100);
+ $date = new Carbon('2013-01-01');
+ $amount = 1200;
+ $bill = $this->object->createFakeBill($description, $date, $amount);
+
+ $this->assertEquals($amount, $bill->amount_max);
+ $this->assertEquals($amount, $bill->amount_min);
+ $this->assertNull($bill->id);
+ $this->assertEquals($description, $bill->name);
+
}
/**
* @covers FireflyIII\Repositories\Bill\BillRepository::destroy
- * @todo Implement testDestroy().
*/
public function testDestroy()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+ $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
+ $id = $bill->id;
+ $this->object->destroy($bill);
+
+ // cannot find bill:
+ $this->assertCount(0, Bill::whereId($id)->whereNotNull('deleted_at')->get());
}
/**