Files
firefly-iii/tests/Feature/Controllers/Transaction/EditControllerTest.php

65 lines
2.0 KiB
PHP
Raw Normal View History

2019-07-20 06:22:37 +02:00
<?php
2019-08-17 12:09:03 +02:00
declare(strict_types=1);
2019-07-20 06:22:37 +02:00
/**
* EditControllerTest.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
*
* This file is part of Firefly III.
*
* Firefly III is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Firefly III is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Tests\Feature\Controllers\Transaction;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
2019-08-29 17:53:25 +02:00
use FireflyIII\Repositories\User\UserRepositoryInterface;
2019-07-20 06:22:37 +02:00
use Log;
use Tests\TestCase;
/**
* Class EditControllerTest
2019-08-17 10:48:28 +02:00
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
2019-07-20 06:22:37 +02:00
*/
class EditControllerTest extends TestCase
{
/**
*
*/
public function setUp(): void
{
parent::setUp();
Log::info(sprintf('Now in %s.', get_class($this)));
}
public function testEdit(): void
{
$group = $this->getRandomWithdrawalGroup();
$account = $this->getRandomAsset();
$accountRepos = $this->mock(AccountRepositoryInterface::class);
2019-08-29 17:53:25 +02:00
$userRepos = $this->mock(UserRepositoryInterface::class);
2019-07-20 06:22:37 +02:00
2019-08-29 17:53:25 +02:00
$this->mockDefaultSession();
$userRepos->shouldReceive('hasRole')->atLeast()->once()->andReturn(true);
2019-07-20 06:22:37 +02:00
$accountRepos->shouldReceive('getCashAccount')->atLeast()->once()->andReturn($account);
$this->be($this->user());
$response = $this->get(route('transactions.edit', [$group->id]));
$response->assertStatus(200);
}
2019-08-17 12:09:03 +02:00
}