mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-30 20:54:04 -06:00
Optimize test code.
This commit is contained in:
parent
f10f5d30bf
commit
05670cf393
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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');
|
||||
|
@ -25,23 +25,6 @@ class HomeControllerTest extends TestCase
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\HomeController::dateRange
|
||||
*/
|
||||
public function testDateRangeWarning()
|
||||
{
|
||||
$start = '2014-03-01';
|
||||
$end = '2015-03-31';
|
||||
$this->be(new FireflyIII\User);
|
||||
$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
|
||||
*/
|
||||
@ -52,7 +35,7 @@ class HomeControllerTest extends TestCase
|
||||
$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');
|
||||
@ -60,6 +43,23 @@ class HomeControllerTest extends TestCase
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Http\Controllers\HomeController::dateRange
|
||||
*/
|
||||
public function testDateRangeWarning()
|
||||
{
|
||||
$start = '2014-03-01';
|
||||
$end = '2015-03-31';
|
||||
$this->be(new FireflyIII\User);
|
||||
$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::index
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user