firefly-iii/tests/acceptance/Controllers/Chart/ChartCategoryControllerTest.php
2016-04-01 16:46:11 +02:00

107 lines
3.3 KiB
PHP

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