firefly-iii/tests/acceptance/Controllers/Chart/ChartCategoryControllerTest.php

107 lines
3.3 KiB
PHP
Raw Normal View History

2016-01-19 23:20:09 -06:00
<?php
/**
* ChartCategoryControllerTest.php
2016-04-01 09:46:11 -05:00
* Copyright (C) 2016 thegrumpydictator@gmail.com
2016-01-19 23:20:09 -06:00
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
use Illuminate\Support\Collection;
2016-01-19 23:20:09 -06:00
/**
* Generated by PHPUnit_SkeletonGenerator on 2016-01-19 at 15:39:57.
*/
class ChartCategoryControllerTest extends TestCase
{
/**
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::all
2016-02-04 00:30:48 -06:00
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::__construct
2016-01-19 23:20:09 -06:00
*/
public function testAll()
{
2016-01-20 02:15:33 -06:00
$this->be($this->user());
2016-01-24 11:11:57 -06:00
$this->call('GET', '/chart/category/1/all');
2016-01-20 02:15:33 -06:00
2016-01-24 11:11:57 -06:00
$this->assertResponseStatus(200);
2016-01-19 23:20:09 -06:00
}
/**
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::currentPeriod
*/
public function testCurrentPeriod()
{
2016-01-20 02:15:33 -06:00
$this->be($this->user());
2016-01-24 11:11:57 -06:00
$this->call('GET', '/chart/category/1/period');
2016-01-20 02:15:33 -06:00
2016-01-24 11:11:57 -06:00
$this->assertResponseStatus(200);
2016-01-19 23:20:09 -06:00
}
/**
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::earnedInPeriod
*/
public function testEarnedInPeriod()
{
2016-01-22 23:59:22 -06:00
$repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$repository->shouldReceive('earnedForAccountsPerMonth')->once()->andReturn(new Collection);
$this->be($this->user());
2016-01-24 11:11:57 -06:00
$this->call('GET', '/chart/category/earned-in-period/default/20150101/20151231/1');
$this->assertResponseStatus(200);
2016-01-19 23:20:09 -06:00
}
/**
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::frontpage
*/
public function testFrontpage()
{
2016-01-22 23:59:22 -06:00
$repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$repository->shouldReceive('spentForAccountsPerMonth')->once()->andReturn(new Collection);
$repository->shouldReceive('sumSpentNoCategory')->once()->andReturn('120');
$this->be($this->user());
2016-01-24 11:11:57 -06:00
$this->call('GET', '/chart/category/frontpage');
$this->assertResponseStatus(200);
2016-01-19 23:20:09 -06:00
}
/**
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::multiYear
*/
public function testMultiYear()
{
2016-01-22 23:59:22 -06:00
$repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$repository->shouldReceive('listMultiYear')->once()->andReturn(new Collection);
$this->be($this->user());
2016-01-24 11:11:57 -06:00
$this->call('GET', '/chart/category/multi-year/default/20150101/20151231/1/1');
$this->assertResponseStatus(200);
2016-01-19 23:20:09 -06:00
}
/**
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::specificPeriod
*/
public function testSpecificPeriod()
{
2016-01-20 02:15:33 -06:00
$this->be($this->user());
2016-01-24 11:11:57 -06:00
$this->call('GET', '/chart/category/1/period/20150101');
2016-01-20 02:15:33 -06:00
2016-01-24 11:11:57 -06:00
$this->assertResponseStatus(200);
2016-01-19 23:20:09 -06:00
}
/**
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::spentInPeriod
*/
public function testSpentInPeriod()
{
2016-01-22 23:59:22 -06:00
$repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$repository->shouldReceive('spentForAccountsPerMonth')->once()->andReturn(new Collection);
$this->be($this->user());
2016-01-24 11:11:57 -06:00
$this->call('GET', '/chart/category/spent-in-period/default/20150101/20151231/1');
$this->assertResponseStatus(200);
2016-01-19 23:20:09 -06:00
}
}