Improve test coverage.

This commit is contained in:
James Cole
2019-07-23 17:33:23 +02:00
parent 1e7e0facf1
commit 226e2f7185
38 changed files with 132 additions and 451 deletions

View File

@@ -51,6 +51,7 @@ class AccountControllerTest extends TestCase
*/
public function testGeneral(): void
{
$this->mockDefaultSession();
$return = [
'accounts' => [],
'start' => '0',

View File

@@ -53,6 +53,7 @@ class BalanceControllerTest extends TestCase
*/
public function testGeneral(): void
{
$this->mockDefaultSession();
$balance = $this->mock(BalanceReportHelperInterface::class);
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
$date = new Carbon;

View File

@@ -54,6 +54,7 @@ class BudgetControllerTest extends TestCase
*/
public function testGeneral(): void
{
$this->mockDefaultSession();
$return = [];
$helper = $this->mock(BudgetReportHelperInterface::class);
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
@@ -72,6 +73,7 @@ class BudgetControllerTest extends TestCase
*/
public function testPeriod(): void
{
$this->mockDefaultSession();
$first = [1 => ['entries' => ['1', '1']]];
$second = ['entries' => ['1', '1']];
$repository = $this->mock(BudgetRepositoryInterface::class);

View File

@@ -54,6 +54,7 @@ class CategoryControllerTest extends TestCase
*/
public function testExpenses(): void
{
$this->mockDefaultSession();
$first = [1 => ['entries' => ['1', '1']]];
$second = ['entries' => ['1', '1']];
$repository = $this->mock(CategoryRepositoryInterface::class);
@@ -75,6 +76,7 @@ class CategoryControllerTest extends TestCase
*/
public function testIncome(): void
{
$this->mockDefaultSession();
$first = [1 => ['entries' => ['1', '1']]];
$second = ['entries' => ['1', '1']];
$repository = $this->mock(CategoryRepositoryInterface::class);
@@ -96,8 +98,9 @@ class CategoryControllerTest extends TestCase
*/
public function testOperations(): void
{
$this->mockDefaultSession();
$repository = $this->mock(CategoryRepositoryInterface::class);
$category = factory(Category::class)->make();
$category = $this->getRandomCategory();
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
$date = new Carbon;
$fiscalHelper->shouldReceive('endOfFiscalYear')->atLeast()->once()->andReturn($date);

View File

@@ -56,6 +56,7 @@ class ExpenseControllerTest extends TestCase
*/
public function testBudget(): void
{
$repository = $this->mock(AccountRepositoryInterface::class);
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
$collector = $this->mock(GroupCollectorInterface::class);

View File

@@ -52,6 +52,7 @@ class OperationsControllerTest extends TestCase
*/
public function testExpenses(): void
{
$this->mockDefaultSession();
$return = [
1 => [
'id' => 1,
@@ -78,6 +79,7 @@ class OperationsControllerTest extends TestCase
*/
public function testIncome(): void
{
$this->mockDefaultSession();
$tasker = $this->mock(AccountTaskerInterface::class);
$fiscalHelper = $this->mock(FiscalHelperInterface::class);
$date = new Carbon;
@@ -95,6 +97,7 @@ class OperationsControllerTest extends TestCase
*/
public function testOperations(): void
{
$this->mockDefaultSession();
$return = [
1 => [
'id' => 1,