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

107 lines
3.3 KiB
PHP
Raw Normal View History

2016-01-20 06:20:09 +01:00
<?php
/**
* ChartCategoryControllerTest.php
* Copyright (C) 2016 Sander Dorigo
*
* 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-20 06:20:09 +01: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 07:30:48 +01:00
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::__construct
2016-01-20 06:20:09 +01:00
*/
public function testAll()
{
2016-01-20 09:15:33 +01:00
$this->be($this->user());
2016-01-24 18:11:57 +01:00
$this->call('GET', '/chart/category/1/all');
2016-01-20 09:15:33 +01:00
2016-01-24 18:11:57 +01:00
$this->assertResponseStatus(200);
2016-01-20 06:20:09 +01:00
}
/**
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::currentPeriod
*/
public function testCurrentPeriod()
{
2016-01-20 09:15:33 +01:00
$this->be($this->user());
2016-01-24 18:11:57 +01:00
$this->call('GET', '/chart/category/1/period');
2016-01-20 09:15:33 +01:00
2016-01-24 18:11:57 +01:00
$this->assertResponseStatus(200);
2016-01-20 06:20:09 +01:00
}
/**
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::earnedInPeriod
*/
public function testEarnedInPeriod()
{
2016-01-23 06:59:22 +01:00
$repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$repository->shouldReceive('earnedForAccountsPerMonth')->once()->andReturn(new Collection);
$this->be($this->user());
2016-01-24 18:11:57 +01:00
$this->call('GET', '/chart/category/earned-in-period/default/20150101/20151231/1');
$this->assertResponseStatus(200);
2016-01-20 06:20:09 +01:00
}
/**
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::frontpage
*/
public function testFrontpage()
{
2016-01-23 06:59:22 +01: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 18:11:57 +01:00
$this->call('GET', '/chart/category/frontpage');
$this->assertResponseStatus(200);
2016-01-20 06:20:09 +01:00
}
/**
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::multiYear
*/
public function testMultiYear()
{
2016-01-23 06:59:22 +01:00
$repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$repository->shouldReceive('listMultiYear')->once()->andReturn(new Collection);
$this->be($this->user());
2016-01-24 18:11:57 +01:00
$this->call('GET', '/chart/category/multi-year/default/20150101/20151231/1/1');
$this->assertResponseStatus(200);
2016-01-20 06:20:09 +01:00
}
/**
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::specificPeriod
*/
public function testSpecificPeriod()
{
2016-01-20 09:15:33 +01:00
$this->be($this->user());
2016-01-24 18:11:57 +01:00
$this->call('GET', '/chart/category/1/period/20150101');
2016-01-20 09:15:33 +01:00
2016-01-24 18:11:57 +01:00
$this->assertResponseStatus(200);
2016-01-20 06:20:09 +01:00
}
/**
* @covers FireflyIII\Http\Controllers\Chart\CategoryController::spentInPeriod
*/
public function testSpentInPeriod()
{
2016-01-23 06:59:22 +01:00
$repository = $this->mock('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$repository->shouldReceive('spentForAccountsPerMonth')->once()->andReturn(new Collection);
$this->be($this->user());
2016-01-24 18:11:57 +01:00
$this->call('GET', '/chart/category/spent-in-period/default/20150101/20151231/1');
$this->assertResponseStatus(200);
2016-01-20 06:20:09 +01:00
}
}