From 6802f0403600da805f8d6b0e020b1e0c6df78992 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 8 May 2015 12:50:39 +0200 Subject: [PATCH] First two tests for bill repository. --- tests/repositories/BillRepositoryTest.php | 29 +++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) 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 @@ 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()); } /**