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
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());
}
/**