Code cleanup.

This commit is contained in:
James Cole
2017-11-22 21:12:27 +01:00
parent 4e6b782204
commit 781ca052d8
142 changed files with 213 additions and 859 deletions

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@@ -43,14 +41,12 @@ use Tests\TestCase;
/**
* Class AccountControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class AccountControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Chart\AccountController::all
*/
@@ -85,7 +81,6 @@ class AccountControllerTest extends TestCase
$generator->shouldReceive('singleSet')->andReturn([]);
Steam::shouldReceive('balancesByAccounts')->twice()->andReturn([]);
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('chart.account.expense'));
@@ -114,7 +109,6 @@ class AccountControllerTest extends TestCase
$generator->shouldReceive('pieChart')->andReturn([]);
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection);
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('chart.account.expense-budget', [1, '20120101', '20120131']));
@@ -145,7 +139,6 @@ class AccountControllerTest extends TestCase
$budgetRepos->shouldReceive('getBudgets')->andReturn(new Collection);
$accountRepos->shouldReceive('oldestJournalDate')->andReturn(Carbon::createFromTimestamp(time())->startOfMonth());
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('chart.account.expense-budget-all', [1]));
@@ -374,5 +367,4 @@ class AccountControllerTest extends TestCase
$response = $this->get(route('chart.account.single', [1]));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\Transaction;
@@ -34,7 +32,6 @@ use Tests\TestCase;
/**
* Class BillControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -82,5 +79,4 @@ class BillControllerTest extends TestCase
$response = $this->get(route('chart.bill.single', [1]));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@@ -42,14 +40,12 @@ use Tests\TestCase;
/**
* Class BudgetControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class BudgetControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::budget
* @covers \FireflyIII\Http\Controllers\Chart\BudgetController::__construct
@@ -66,7 +62,6 @@ class BudgetControllerTest extends TestCase
$repository->shouldReceive('spentInPeriod')->andReturn('-100');
$generator->shouldReceive('singleSet')->andReturn([])->once();
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('chart.budget.budget', [1]));
@@ -84,7 +79,6 @@ class BudgetControllerTest extends TestCase
$repository = $this->mock(BudgetRepositoryInterface::class);
$generator = $this->mock(GeneratorInterface::class);
$repository->shouldReceive('spentInPeriod')->andReturn('-100');
$generator->shouldReceive('singleSet')->once()->andReturn([]);
@@ -214,7 +208,6 @@ class BudgetControllerTest extends TestCase
$budgetLimit->budget_id = $budget->id;
$transaction = factory(Transaction::class)->make();
$repository->shouldReceive('getActiveBudgets')->andReturn(new Collection([$budget]))->once();
$repository->shouldReceive('getBudgetLimits')->once()->andReturn(new Collection([$budgetLimit]));
$repository->shouldReceive('spentInPeriod')->andReturn('-100');
@@ -254,7 +247,6 @@ class BudgetControllerTest extends TestCase
$two->budget_id = $budget->id;
$transaction = factory(Transaction::class)->make();
$repository->shouldReceive('getActiveBudgets')->andReturn(new Collection([$budget]))->once();
$repository->shouldReceive('getBudgetLimits')->once()->andReturn(new Collection([$one, $two]));
$repository->shouldReceive('spentInPeriod')->andReturn('-100');
@@ -290,7 +282,6 @@ class BudgetControllerTest extends TestCase
$budget = factory(Budget::class)->make();
$transaction = factory(Transaction::class)->make();
$repository->shouldReceive('getActiveBudgets')->andReturn(new Collection([$budget]));
$repository->shouldReceive('getBudgetLimits')->once()->andReturn(new Collection);
$repository->shouldReceive('spentInPeriod')->andReturn('-100');
@@ -325,7 +316,6 @@ class BudgetControllerTest extends TestCase
$repository->shouldReceive('getBudgetLimits')->andReturn(new Collection([$budgetLimit]));
$generator->shouldReceive('multiSet')->once()->andReturn([]);
$this->be($this->user());
$response = $this->get(route('chart.budget.period', [1, '1', '20120101', '20120131']));
$response->assertStatus(200);

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Chart\MetaPieChartInterface;
@@ -41,7 +39,6 @@ use Tests\TestCase;
/**
* Class BudgetReportControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -117,7 +114,6 @@ class BudgetReportControllerTest extends TestCase
$budgetRepos->shouldReceive('getAllBudgetLimits')->andReturn(new Collection([$one, $two]))->once();
$collector->shouldReceive('setAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf();
$collector->shouldReceive('setTypes')->withArgs([[TransactionType::WITHDRAWAL, TransactionType::TRANSFER]])->andReturnSelf();
@@ -134,5 +130,4 @@ class BudgetReportControllerTest extends TestCase
$response = $this->get(route('chart.budget.main', ['1', '1', '20120101', '20120131', 0]));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Models\Account;
@@ -37,14 +35,12 @@ use Tests\TestCase;
/**
* Class CategoryControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class CategoryControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::all
* @covers \FireflyIII\Http\Controllers\Chart\CategoryController::__construct
@@ -64,7 +60,6 @@ class CategoryControllerTest extends TestCase
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection)->once();
$generator->shouldReceive('multiSet')->once()->andReturn([]);
$this->be($this->user());
$this->changeDateRange($this->user(), $range);
$response = $this->get(route('chart.category.all', [1]));
@@ -109,7 +104,6 @@ class CategoryControllerTest extends TestCase
$repository->shouldReceive('periodIncome')->andReturn([])->once();
$generator->shouldReceive('multiSet')->andReturn([])->once();
$this->be($this->user());
$response = $this->get(route('chart.category.period', [1, '1', '20120101', '20120131']));
$response->assertStatus(200);
@@ -156,5 +150,4 @@ class CategoryControllerTest extends TestCase
$response = $this->get(route('chart.category.specific', ['1', '2012-01-01']));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Chart\MetaPieChartInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@@ -38,14 +36,12 @@ use Tests\TestCase;
/**
* Class CategoryReportControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class CategoryReportControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::accountExpense
* @covers \FireflyIII\Http\Controllers\Chart\CategoryReportController::__construct
@@ -160,5 +156,4 @@ class CategoryReportControllerTest extends TestCase
$response = $this->get(route('chart.category.main', ['1', '1', '20120101', '20120131']));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
@@ -33,7 +31,6 @@ use Tests\TestCase;
/**
* Class PiggyBankControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -57,6 +54,4 @@ class PiggyBankControllerTest extends TestCase
$response = $this->get(route('chart.piggy-bank.history', [1]));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Repositories\Account\AccountTaskerInterface;
use Steam;
@@ -32,14 +30,12 @@ use Tests\TestCase;
/**
* Class ReportControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ReportControllerTest extends TestCase
{
/**
* @covers \FireflyIII\Http\Controllers\Chart\ReportController::netWorth
* @covers \FireflyIII\Http\Controllers\Chart\ReportController::arraySum
@@ -96,5 +92,4 @@ class ReportControllerTest extends TestCase
$response = $this->get(route('chart.report.sum', [1, '20120101', '20120131']));
$response->assertStatus(200);
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Tests\Feature\Controllers\Chart;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Chart\MetaPieChartInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@@ -40,7 +38,6 @@ use Tests\TestCase;
/**
* Class TagReportControllerTest
*
* @package Tests\Feature\Controllers\Chart
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -88,7 +85,6 @@ class TagReportControllerTest extends TestCase
$this->be($this->user());
$response = $this->get(route('chart.tag.account-income', ['1', 'housing', '20120101', '20120131', 0]));
$response->assertStatus(200);
}
/**
@@ -144,16 +140,13 @@ class TagReportControllerTest extends TestCase
$generator = $this->mock(GeneratorInterface::class);
$collector = $this->mock(JournalCollectorInterface::class);
$set = new Collection;
for ($i = 0; $i < 10; $i++) {
for ($i = 0; $i < 10; ++$i) {
$transaction = factory(Transaction::class)->make();
$tag = factory(Tag::class)->make();
$transaction->transactionJournal->tags()->save($tag);
$set->push($transaction);
}
$collector->shouldReceive('setAccounts')->andReturnSelf();
$collector->shouldReceive('setRange')->andReturnSelf();
$collector->shouldReceive('setTypes')->withArgs([[TransactionType::WITHDRAWAL, TransactionType::TRANSFER]])->andReturnSelf();
@@ -213,6 +206,4 @@ class TagReportControllerTest extends TestCase
$response = $this->get(route('chart.tag.tag-income', ['1', 'housing', '20120101', '20120131', 0]));
$response->assertStatus(200);
}
}