First two tests for bill repository.

This commit is contained in:
James Cole 2015-05-08 12:50:39 +02:00
parent beeccdf345
commit 6802f04036

View File

@ -1,5 +1,8 @@
<?php <?php
use Carbon\Carbon;
use FireflyIII\Models\Bill;
use FireflyIII\Repositories\Bill\BillRepository; use FireflyIII\Repositories\Bill\BillRepository;
use League\FactoryMuffin\Facade as FactoryMuffin;
/** /**
* Generated by PHPUnit_SkeletonGenerator on 2015-05-08 at 10:43:42. * 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 * @covers FireflyIII\Repositories\Bill\BillRepository::createFakeBill
* @todo Implement testCreateFakeBill().
*/ */
public function testCreateFakeBill() public function testCreateFakeBill()
{ {
// Remove the following lines when you implement this test. $description = 'Fake bill ' . rand(10, 100);
$this->markTestIncomplete( $date = new Carbon('2013-01-01');
'This test has not been implemented yet.' $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 * @covers FireflyIII\Repositories\Bill\BillRepository::destroy
* @todo Implement testDestroy().
*/ */
public function testDestroy() public function testDestroy()
{ {
// Remove the following lines when you implement this test. $bill = FactoryMuffin::create('FireflyIII\Models\Bill');
$this->markTestIncomplete( $id = $bill->id;
'This test has not been implemented yet.' $this->object->destroy($bill);
);
// cannot find bill:
$this->assertCount(0, Bill::whereId($id)->whereNotNull('deleted_at')->get());
} }
/** /**