Skip to content

Firefly III: a personal finances manager

New (empty) tests for models.

James Cole8f2f912cdfcc
diff --git a/tests/controllers/TransactionControllerTest.php b/tests/controllers/TransactionControllerTest.php
index d397f1f11c..cbf2c25365 100644
--- a/tests/controllers/TransactionControllerTest.php
+++ b/tests/controllers/TransactionControllerTest.php
@@ -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
diff --git a/tests/controllers/charts/ChartBillControllerTest.php b/tests/controllers/charts/ChartBillControllerTest.php
index 4bdf092e9b..884c4627ff 100644
--- a/tests/controllers/charts/ChartBillControllerTest.php
+++ b/tests/controllers/charts/ChartBillControllerTest.php
@@ -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');
diff --git a/tests/controllers/charts/ChartCategoryControllerTest.php b/tests/controllers/charts/ChartCategoryControllerTest.php
index ee70bfcd77..fe544b7d1f 100644
--- a/tests/controllers/charts/ChartCategoryControllerTest.php
+++ b/tests/controllers/charts/ChartCategoryControllerTest.php
@@ -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();
}
diff --git a/tests/models/AccountModelTest.php b/tests/models/AccountModelTest.php
new file mode 100644
index 0000000000..f42ca9b720
--- /dev/null
+++ b/tests/models/AccountModelTest.php
@@ -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();
+ }
+
+}
\ No newline at end of file
diff --git a/tests/models/CategoryModelTest.php b/tests/models/CategoryModelTest.php
new file mode 100644
index 0000000000..8b8709038b
--- /dev/null
+++ b/tests/models/CategoryModelTest.php
@@ -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();
+ }
+
+}
\ No newline at end of file
diff --git a/tests/models/TagModelTest.php b/tests/models/TagModelTest.php
new file mode 100644
index 0000000000..54e4b5f0ac
--- /dev/null
+++ b/tests/models/TagModelTest.php
@@ -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();
+ }
+
+}
\ No newline at end of file
diff --git a/tests/models/TransactionJournalModelTes.php b/tests/models/TransactionJournalModelTes.php
new file mode 100644
index 0000000000..b31cef4329
--- /dev/null
+++ b/tests/models/TransactionJournalModelTes.php
@@ -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();
+ }
+
+}
\ No newline at end of file