Files
firefly-iii/tests/acceptance/Controllers/HomeControllerTest.php

97 lines
2.6 KiB
PHP
Raw Normal View History

2016-11-19 15:55:49 +01:00
<?php
/**
* HomeControllerTest.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
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',
];
2016-11-20 07:24:18 +01:00
$this->call('POST', route('daterange'), $args);
2016-11-19 15:55:49 +01:00
$this->assertResponseStatus(200);
$this->assertSessionHas('warning', '91 days of data may take a while to load.');
}
2016-11-20 07:24:18 +01:00
/**
* @covers FireflyIII\Http\Controllers\HomeController::displayError
*/
public function testDisplayError()
{
$this->be($this->user());
2016-12-06 09:12:04 +01:00
$this->call('GET', route('error'));
2016-11-20 07:24:18 +01:00
$this->assertResponseStatus(500);
}
2016-11-19 15:55:49 +01:00
/**
* @covers FireflyIII\Http\Controllers\HomeController::flush
*/
public function testFlush()
{
$this->be($this->user());
2016-11-20 07:24:18 +01:00
$this->call('GET', route('flush'));
2016-11-19 15:55:49 +01:00
$this->assertResponseStatus(302);
}
/**
* @covers FireflyIII\Http\Controllers\HomeController::index
* @covers FireflyIII\Http\Controllers\Controller::__construct
* @dataProvider dateRangeProvider
*
* @param $range
*/
2016-12-10 07:29:36 +01:00
public function testIndex(string $range)
2016-11-19 15:55:49 +01:00
{
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
2016-11-20 07:24:18 +01:00
$this->call('GET', route('index'));
2016-11-19 15:55:49 +01:00
$this->assertResponseStatus(200);
}
2016-11-20 07:24:18 +01:00
/**
* @covers FireflyIII\Http\Controllers\HomeController::routes
* @dataProvider dateRangeProvider
*
* @param string $range
*/
public function testRoutes(string $range)
{
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
2016-12-09 16:30:33 +01:00
$this->call('GET', route('all-routes'));
2016-11-20 07:24:18 +01:00
$this->assertResponseStatus(200);
}
/**
* @covers FireflyIII\Http\Controllers\HomeController::testFlash
*/
public function testTestFlash()
{
$this->be($this->user());
2016-12-09 16:30:33 +01:00
$this->call('GET', route('test-flash'));
2016-11-20 07:24:18 +01:00
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
$this->assertSessionHas('info');
$this->assertSessionHas('warning');
$this->assertSessionHas('error');
}
2016-11-19 15:55:49 +01:00
}