firefly-iii/tests/controllers/HomeControllerTest.php

87 lines
2.1 KiB
PHP
Raw Normal View History

2015-03-13 02:44:07 -05:00
<?php
/**
* Generated by PHPUnit_SkeletonGenerator on 2015-03-08 at 20:05:14.
*/
class HomeControllerTest 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();
2015-03-31 10:49:47 -05:00
Artisan::call('migrate');
2015-03-13 02:44:07 -05:00
}
/**
* 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\Http\Controllers\HomeController::dateRange
*/
2015-03-28 00:19:09 -05:00
public function testDateRangeWarning()
2015-03-13 02:44:07 -05:00
{
2015-03-28 00:19:09 -05:00
$start = '2014-03-01';
$end = '2015-03-31';
2015-03-31 10:49:47 -05:00
$this->be(new FireflyIII\User);
$this->call('POST', '/daterange', ['end' => $end, 'start' => $start,'_token' => 'replaceme']);
2015-03-28 00:19:09 -05:00
$this->assertResponseOk();
$this->assertSessionHas('start');
$this->assertSessionHas('end');
$this->assertSessionHas('warning');
2015-03-13 02:44:07 -05:00
}
/**
2015-03-28 00:19:09 -05:00
* @covers FireflyIII\Http\Controllers\HomeController::dateRange
2015-03-13 02:44:07 -05:00
*/
2015-03-28 00:19:09 -05:00
public function testDateRange()
2015-03-13 02:44:07 -05:00
{
2015-03-28 00:19:09 -05:00
$start = '2015-03-01';
$end = '2015-03-31';
2015-03-31 10:49:47 -05:00
$this->be(new FireflyIII\User);
2015-03-28 00:19:09 -05:00
$this->call('POST', '/daterange', ['end' => $end, 'start' => $start,'_token' => 'replaceme']);
2015-03-28 00:19:09 -05:00
$this->assertResponseOk();
$this->assertSessionHas('start');
$this->assertSessionHas('end');
2015-03-13 02:44:07 -05:00
}
/**
* @covers FireflyIII\Http\Controllers\HomeController::index
*/
2015-03-28 00:19:09 -05:00
public function testIndexLoggedIn()
2015-03-13 02:44:07 -05:00
{
2015-03-31 10:49:47 -05:00
$this->be(new FireflyIII\User);
Amount::shouldReceive('getCurrencyCode')->andReturn('EUR');
2015-03-13 02:44:07 -05:00
$response = $this->call('GET', '/');
2015-03-28 00:19:09 -05:00
$this->assertResponseOk();
2015-03-13 02:44:07 -05:00
}
/**
* @covers FireflyIII\Http\Controllers\HomeController::index
*/
2015-03-28 00:19:09 -05:00
public function testIndexNoLogin()
2015-03-13 02:44:07 -05:00
{
$response = $this->call('GET', '/');
2015-03-28 00:19:09 -05:00
$this->assertRedirectedTo('auth/login');
2015-03-13 02:44:07 -05:00
}
}