mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-07 13:23:31 +00:00
New (empty) tests for models.
This commit is contained in:
@@ -257,7 +257,7 @@ class TransactionControllerTest extends TestCase
|
|||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
* @covers FireflyIII\Http\Controllers\TransactionController::store
|
* @covers FireflyIII\Http\Controllers\TransactionController::store
|
||||||
*/
|
*/
|
||||||
public function testStore()
|
public function testStoreCreateAnother()
|
||||||
{
|
{
|
||||||
$account = FactoryMuffin::create('FireflyIII\Models\Account');
|
$account = FactoryMuffin::create('FireflyIII\Models\Account');
|
||||||
$currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency');
|
$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)
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
* @covers FireflyIII\Http\Controllers\TransactionController::store
|
* @covers FireflyIII\Http\Controllers\TransactionController::store
|
||||||
|
@@ -58,7 +58,7 @@ class ChartBillControllerTest extends TestCase
|
|||||||
$accounts->shouldReceive('getCreditCards')->andReturn($creditCards);
|
$accounts->shouldReceive('getCreditCards')->andReturn($creditCards);
|
||||||
$accounts->shouldReceive('getTransfersInRange')->andReturn(new Collection);
|
$accounts->shouldReceive('getTransfersInRange')->andReturn(new Collection);
|
||||||
$repository->shouldReceive('createFakeBill')->andReturn($bills->first());
|
$repository->shouldReceive('createFakeBill')->andReturn($bills->first());
|
||||||
Steam::shouldReceive('balance')->andReturn(-10,0);
|
Steam::shouldReceive('balance')->andReturn(-10, 0);
|
||||||
|
|
||||||
|
|
||||||
$this->call('GET', '/chart/bill/frontpage');
|
$this->call('GET', '/chart/bill/frontpage');
|
||||||
|
@@ -35,7 +35,7 @@ class ChartCategoryControllerTest extends TestCase
|
|||||||
$category = FactoryMuffin::create('FireflyIII\Models\Category');
|
$category = FactoryMuffin::create('FireflyIII\Models\Category');
|
||||||
$this->be($category->user);
|
$this->be($category->user);
|
||||||
|
|
||||||
$this->call('GET', '/chart/category/'.$category->id.'/all');
|
$this->call('GET', '/chart/category/' . $category->id . '/all');
|
||||||
$this->assertResponseOk();
|
$this->assertResponseOk();
|
||||||
|
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ class ChartCategoryControllerTest extends TestCase
|
|||||||
$category = FactoryMuffin::create('FireflyIII\Models\Category');
|
$category = FactoryMuffin::create('FireflyIII\Models\Category');
|
||||||
$this->be($category->user);
|
$this->be($category->user);
|
||||||
|
|
||||||
$this->call('GET', '/chart/category/'.$category->id.'/month');
|
$this->call('GET', '/chart/category/' . $category->id . '/month');
|
||||||
$this->assertResponseOk();
|
$this->assertResponseOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
54
tests/models/AccountModelTest.php
Normal file
54
tests/models/AccountModelTest.php
Normal 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
46
tests/models/CategoryModelTest.php
Normal file
46
tests/models/CategoryModelTest.php
Normal 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
46
tests/models/TagModelTest.php
Normal file
46
tests/models/TagModelTest.php
Normal 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
78
tests/models/TransactionJournalModelTes.php
Normal file
78
tests/models/TransactionJournalModelTes.php
Normal 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user