mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-24 14:46:37 +00:00
First set of new tests.
This commit is contained in:
@@ -15,5 +15,72 @@ use Tests\TestCase;
|
||||
|
||||
class HomeControllerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\HomeController::dateRange
|
||||
* @covers \FireflyIII\Http\Controllers\HomeController::__construct
|
||||
*/
|
||||
public function testDateRange()
|
||||
{
|
||||
|
||||
$this->be($this->user());
|
||||
|
||||
$args = [
|
||||
'start' => '2012-01-01',
|
||||
'end' => '2012-04-01',
|
||||
];
|
||||
|
||||
$response = $this->post(route('daterange'), $args);
|
||||
$response->assertStatus(200);
|
||||
$response->assertSessionHas('warning', '91 days of data may take a while to load.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\HomeController::displayError
|
||||
*/
|
||||
public function testDisplayError()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('error'));
|
||||
$response->assertStatus(500);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\HomeController::flush
|
||||
*/
|
||||
public function testFlush()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('flush'));
|
||||
$response->assertStatus(302);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\HomeController::index
|
||||
* @covers \FireflyIII\Http\Controllers\Controller::__construct
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param $range
|
||||
*/
|
||||
public function testIndex(string $range)
|
||||
{
|
||||
$this->be($this->user());
|
||||
$this->changeDateRange($this->user(), $range);
|
||||
$response = $this->get(route('index'));
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\HomeController::testFlash
|
||||
*/
|
||||
public function testTestFlash()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('test-flash'));
|
||||
$response->assertStatus(302);
|
||||
$response->assertSessionHas('success');
|
||||
$response->assertSessionHas('info');
|
||||
$response->assertSessionHas('warning');
|
||||
$response->assertSessionHas('error');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user