Skip to content

Firefly III: a personal finances manager

Optimize test code.

James Cole05670cf39363
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 9ceb86ea36..336e5f2a9a 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -22,16 +22,6 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
return $app;
}
- /**
- * 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();
- }
-
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
@@ -44,7 +34,15 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
}
-
+ /**
+ * 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();
+ }
/**
* @param string $class
@@ -61,5 +59,4 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
}
-
}
diff --git a/tests/controllers/AccountControllerTest.php b/tests/controllers/AccountControllerTest.php
index 63af83b215..58b908c640 100644
--- a/tests/controllers/AccountControllerTest.php
+++ b/tests/controllers/AccountControllerTest.php
@@ -174,7 +174,7 @@ class AccountControllerTest extends TestCase
// mock!
Amount::shouldReceive('getCurrencyCode')->once()->andReturn('A');
$repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface');
- $repository->shouldReceive('getJournals')->andReturn(new LengthAwarePaginator([],0,10));
+ $repository->shouldReceive('getJournals')->andReturn(new LengthAwarePaginator([], 0, 10));
// get edit page:
$this->call('GET', '/accounts/show/' . $this->account->id);
diff --git a/tests/controllers/GoogleChartControllerTest.php b/tests/controllers/GoogleChartControllerTest.php
index 23ce5ccc8e..3600a2eebb 100644
--- a/tests/controllers/GoogleChartControllerTest.php
+++ b/tests/controllers/GoogleChartControllerTest.php
@@ -306,7 +306,7 @@ class GoogleChartControllerTest extends TestCase
// expect!
$repository->shouldReceive('incomeByPeriod')->andReturn($journals);
$repository->shouldReceive('journalsByExpenseAccount')->andReturn($journals);
- Preferences::shouldReceive('get')->withArgs(['showSharedReports',false])->once()->andReturn($preference);
+ Preferences::shouldReceive('get')->withArgs(['showSharedReports', false])->once()->andReturn($preference);
$this->call('GET', '/chart/reports/income-expenses/2015');
@@ -329,7 +329,7 @@ class GoogleChartControllerTest extends TestCase
// expect!
$repository->shouldReceive('incomeByPeriod')->andReturn($journals);
$repository->shouldReceive('journalsByExpenseAccount')->andReturn($journals);
- Preferences::shouldReceive('get')->withArgs(['showSharedReports',false])->once()->andReturn($preference);
+ Preferences::shouldReceive('get')->withArgs(['showSharedReports', false])->once()->andReturn($preference);
$this->call('GET', '/chart/reports/income-expenses-sum/2015');
diff --git a/tests/controllers/HomeControllerTest.php b/tests/controllers/HomeControllerTest.php
index e49ea0fcfc..3e98aa6f64 100644
--- a/tests/controllers/HomeControllerTest.php
+++ b/tests/controllers/HomeControllerTest.php
@@ -28,35 +28,35 @@ class HomeControllerTest extends TestCase
/**
* @covers FireflyIII\Http\Controllers\HomeController::dateRange
*/
- public function testDateRangeWarning()
+ public function testDateRange()
{
- $start = '2014-03-01';
+ $start = '2015-03-01';
$end = '2015-03-31';
$this->be(new FireflyIII\User);
- $this->call('POST', '/daterange', ['end' => $end, 'start' => $start,'_token' => 'replaceme']);
+
+
+ $this->call('POST', '/daterange', ['end' => $end, 'start' => $start, '_token' => 'replaceme']);
$this->assertResponseOk();
$this->assertSessionHas('start');
$this->assertSessionHas('end');
- $this->assertSessionHas('warning');
}
/**
* @covers FireflyIII\Http\Controllers\HomeController::dateRange
*/
- public function testDateRange()
+ public function testDateRangeWarning()
{
- $start = '2015-03-01';
+ $start = '2014-03-01';
$end = '2015-03-31';
$this->be(new FireflyIII\User);
-
-
- $this->call('POST', '/daterange', ['end' => $end, 'start' => $start,'_token' => 'replaceme']);
+ $this->call('POST', '/daterange', ['end' => $end, 'start' => $start, '_token' => 'replaceme']);
$this->assertResponseOk();
$this->assertSessionHas('start');
$this->assertSessionHas('end');
+ $this->assertSessionHas('warning');
}