New (empty) tests for models.

This commit is contained in:
James Cole 2015-05-24 10:01:00 +02:00
parent bf6ea16acb
commit 8f2f912cdf
7 changed files with 274 additions and 4 deletions

View File

@ -257,7 +257,7 @@ class TransactionControllerTest extends TestCase
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @covers FireflyIII\Http\Controllers\TransactionController::store
*/
public function testStore()
public function testStoreCreateAnother()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
@ -300,6 +300,52 @@ class TransactionControllerTest extends TestCase
}
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @covers FireflyIII\Http\Controllers\TransactionController::store
*/
public function testStore()
{
$account = FactoryMuffin::create('FireflyIII\Models\Account');
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
$journal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
FactoryMuffin::create('FireflyIII\Models\TransactionType');
$this->be($account->user);
$data = [
'reminder_id' => '',
'what' => 'withdrawal',
'description' => 'Bla bla bla',
'account_id' => $account->id,
'expense_account' => 'Bla bla',
'amount' => '100',
'amount_currency_id' => $currency->id,
'date' => '2015-05-05',
'budget_id' => '0',
'category' => '',
'tags' => 'fat-test',
'piggy_bank_id' => '0',
'_token' => 'replaceMe',
];
// mock!
$repository = $this->mock('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
// fake!
$repository->shouldReceive('store')->andReturn($journal);
$repository->shouldReceive('deactivateReminder')->andReturnNull();
$this->call('POST', '/transactions/store/withdrawal', $data);
//$this->assertSessionHas('errors','bla');
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
}
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @covers FireflyIII\Http\Controllers\TransactionController::store

View File

@ -58,7 +58,7 @@ class ChartBillControllerTest extends TestCase
$accounts->shouldReceive('getCreditCards')->andReturn($creditCards);
$accounts->shouldReceive('getTransfersInRange')->andReturn(new Collection);
$repository->shouldReceive('createFakeBill')->andReturn($bills->first());
Steam::shouldReceive('balance')->andReturn(-10,0);
Steam::shouldReceive('balance')->andReturn(-10, 0);
$this->call('GET', '/chart/bill/frontpage');

View File

@ -35,7 +35,7 @@ class ChartCategoryControllerTest extends TestCase
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$this->be($category->user);
$this->call('GET', '/chart/category/'.$category->id.'/all');
$this->call('GET', '/chart/category/' . $category->id . '/all');
$this->assertResponseOk();
@ -76,7 +76,7 @@ class ChartCategoryControllerTest extends TestCase
$category = FactoryMuffin::create('FireflyIII\Models\Category');
$this->be($category->user);
$this->call('GET', '/chart/category/'.$category->id.'/month');
$this->call('GET', '/chart/category/' . $category->id . '/month');
$this->assertResponseOk();
}

View File

@ -0,0 +1,54 @@
<?php
/**
* Class AccountModelTest
*/
class AccountModelTest extends TestCase
{
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
parent::setUp();
}
/**
* This method is called before the first test of this test class is run.
*
* @since Method available since Release 3.4.0
*/
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* @covers FireflyIII\Models\Account::firstOrCreateEncrypted
*/
public function testFirstOrCreateEncrypted()
{
$this->markTestIncomplete();
}
/**
* @covers FireflyIII\Models\Account::firstOrNullEncrypted
*/
public function testFirstOrNullEncrypted()
{
$this->markTestIncomplete();
}
}

View File

@ -0,0 +1,46 @@
<?php
/**
* Class CategoryModelTest
*/
class CategoryModelTest extends TestCase
{
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
parent::setUp();
}
/**
* This method is called before the first test of this test class is run.
*
* @since Method available since Release 3.4.0
*/
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* @covers FireflyIII\Models\Category::firstOrCreateEncrypted
*/
public function testFirstOrCreateEncrypted()
{
$this->markTestIncomplete();
}
}

View File

@ -0,0 +1,46 @@
<?php
/**
* Class TagModelTest
*/
class TagModelTest extends TestCase
{
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
parent::setUp();
}
/**
* This method is called before the first test of this test class is run.
*
* @since Method available since Release 3.4.0
*/
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* @covers FireflyIII\Models\Tag::firstOrCreateEncrypted
*/
public function testFirstOrCreateEncrypted()
{
$this->markTestIncomplete();
}
}

View File

@ -0,0 +1,78 @@
<?php
/**
* Class TransactionJournalModelTest
*/
class TransactionJournalModelTest extends TestCase
{
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
parent::setUp();
}
/**
* This method is called before the first test of this test class is run.
*
* @since Method available since Release 3.4.0
*/
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
public function tearDown()
{
parent::tearDown();
}
/**
* @covers FireflyIII\Models\TransactionJournal::getActualAmountAttribute
*/
public function testGetActualAmountAttribute()
{
$this->markTestIncomplete();
}
/**
* @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
*/
public function testGetAmountAttribute()
{
$this->markTestIncomplete();
}
/**
* @covers FireflyIII\Models\TransactionJournal::getAssetAccountAttribute
*/
public function testGetAssetAccountAttribute()
{
$this->markTestIncomplete();
}
/**
* @covers FireflyIII\Models\TransactionJournal::getCorrectedActualAmountAttribute
*/
public function testGetCorrectedActualAmountAttribute()
{
$this->markTestIncomplete();
}
/**
* @covers FireflyIII\Models\TransactionJournal::getDestinationAccountAttribute
*/
public function testGetDestinationAccountAttribute()
{
$this->markTestIncomplete();
}
}