mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleanup.
This commit is contained in:
parent
fbe4435599
commit
0ef6d2f91a
@ -6,6 +6,8 @@ use Illuminate\Support\ServiceProvider;
|
|||||||
* Class AppServiceProvider
|
* Class AppServiceProvider
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Providers
|
* @package FireflyIII\Providers
|
||||||
|
*
|
||||||
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,8 @@ use Illuminate\Support\ServiceProvider;
|
|||||||
/**
|
/**
|
||||||
* Class BusServiceProvider
|
* Class BusServiceProvider
|
||||||
*
|
*
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
*
|
||||||
* @package FireflyIII\Providers
|
* @package FireflyIII\Providers
|
||||||
*/
|
*/
|
||||||
class BusServiceProvider extends ServiceProvider
|
class BusServiceProvider extends ServiceProvider
|
||||||
|
@ -6,6 +6,8 @@ use Illuminate\Support\ServiceProvider;
|
|||||||
* Class ConfigServiceProvider
|
* Class ConfigServiceProvider
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Providers
|
* @package FireflyIII\Providers
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
class ConfigServiceProvider extends ServiceProvider
|
class ConfigServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,7 @@ use Validator;
|
|||||||
* Class FireflyServiceProvider
|
* Class FireflyServiceProvider
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Providers
|
* @package FireflyIII\Providers
|
||||||
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class FireflyServiceProvider extends ServiceProvider
|
class FireflyServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@ use Illuminate\Routing\Router;
|
|||||||
* Class RouteServiceProvider
|
* Class RouteServiceProvider
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Providers
|
* @package FireflyIII\Providers
|
||||||
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class RouteServiceProvider extends ServiceProvider
|
class RouteServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@ use Illuminate\Support\ServiceProvider;
|
|||||||
/**
|
/**
|
||||||
* Class TestingServiceProvider
|
* Class TestingServiceProvider
|
||||||
*
|
*
|
||||||
|
* @codeCoverageIgnore
|
||||||
* @package FireflyIII\Providers
|
* @package FireflyIII\Providers
|
||||||
*/
|
*/
|
||||||
class TestingServiceProvider extends ServiceProvider
|
class TestingServiceProvider extends ServiceProvider
|
||||||
|
@ -13,18 +13,6 @@ use Illuminate\Support\Collection;
|
|||||||
interface PiggyBankRepositoryInterface
|
interface PiggyBankRepositoryInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getPiggyBanks();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param PiggyBank $piggyBank
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getEvents(PiggyBank $piggyBank);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param PiggyBank $piggyBank
|
* @param PiggyBank $piggyBank
|
||||||
* @param $amount
|
* @param $amount
|
||||||
@ -33,6 +21,13 @@ interface PiggyBankRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function createEvent(PiggyBank $piggyBank, $amount);
|
public function createEvent(PiggyBank $piggyBank, $amount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PiggyBank $piggyBank
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function destroy(PiggyBank $piggyBank);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param PiggyBank $piggyBank
|
* @param PiggyBank $piggyBank
|
||||||
*
|
*
|
||||||
@ -43,9 +38,14 @@ interface PiggyBankRepositoryInterface
|
|||||||
/**
|
/**
|
||||||
* @param PiggyBank $piggyBank
|
* @param PiggyBank $piggyBank
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function destroy(PiggyBank $piggyBank);
|
public function getEvents(PiggyBank $piggyBank);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getPiggyBanks();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set all piggy banks to order 0.
|
* Set all piggy banks to order 0.
|
||||||
|
@ -57,6 +57,24 @@ class BudgetControllerTest extends TestCase
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers FireflyIII\Http\Controllers\BudgetController::amount
|
||||||
|
*/
|
||||||
|
public function testAmountZero()
|
||||||
|
{
|
||||||
|
$repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||||
|
$limitRepetition = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
|
||||||
|
$budget = $limitRepetition->budgetlimit->budget;
|
||||||
|
$this->be($budget->user);
|
||||||
|
$today = new Carbon;
|
||||||
|
|
||||||
|
$this->session(['start' => $today]);
|
||||||
|
$repository->shouldReceive('updateLimitAmount')->once()->andReturn($limitRepetition);
|
||||||
|
$this->call('POST', '/budgets/amount/' . $budget->id, ['amount' => 0, '_token' => 'replaceme']);
|
||||||
|
$this->assertResponseOk();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers FireflyIII\Http\Controllers\BudgetController::create
|
* @covers FireflyIII\Http\Controllers\BudgetController::create
|
||||||
*/
|
*/
|
||||||
@ -128,12 +146,13 @@ class BudgetControllerTest extends TestCase
|
|||||||
$collection = new Collection;
|
$collection = new Collection;
|
||||||
$collection->push($budget);
|
$collection->push($budget);
|
||||||
$repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
$repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||||
|
$repetition = FactoryMuffin::create('FireflyIII\Models\LimitRepetition');
|
||||||
|
|
||||||
$repository->shouldReceive('getActiveBudgets')->once()->andReturn($collection);
|
$repository->shouldReceive('getActiveBudgets')->once()->andReturn($collection);
|
||||||
$repository->shouldReceive('getInactiveBudgets')->once()->andReturn($collection);
|
$repository->shouldReceive('getInactiveBudgets')->once()->andReturn($collection);
|
||||||
$repository->shouldReceive('cleanupBudgets')->once();
|
$repository->shouldReceive('cleanupBudgets')->once();
|
||||||
$repository->shouldReceive('spentInPeriodCorrected')->once();
|
$repository->shouldReceive('spentInPeriodCorrected')->once();
|
||||||
$repository->shouldReceive('getCurrentRepetition')->once();
|
$repository->shouldReceive('getCurrentRepetition')->once()->andReturn($repetition);
|
||||||
Amount::shouldReceive('getCurrencySymbol')->andReturn('x');
|
Amount::shouldReceive('getCurrencySymbol')->andReturn('x');
|
||||||
Amount::shouldReceive('format')->andReturn('x');
|
Amount::shouldReceive('format')->andReturn('x');
|
||||||
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
|
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
|
||||||
|
@ -38,6 +38,7 @@ class HelpControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Everything present and accounted for, and in cache:
|
* Everything present and accounted for, and in cache:
|
||||||
|
*
|
||||||
* @covers FireflyIII\Http\Controllers\HelpController::show
|
* @covers FireflyIII\Http\Controllers\HelpController::show
|
||||||
*/
|
*/
|
||||||
public function testGetHelpText()
|
public function testGetHelpText()
|
||||||
@ -59,6 +60,7 @@ class HelpControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Everything present and accounted for, but not cached
|
* Everything present and accounted for, but not cached
|
||||||
|
*
|
||||||
* @covers FireflyIII\Http\Controllers\HelpController::show
|
* @covers FireflyIII\Http\Controllers\HelpController::show
|
||||||
*/
|
*/
|
||||||
public function testGetHelpTextNoCache()
|
public function testGetHelpTextNoCache()
|
||||||
@ -82,6 +84,7 @@ class HelpControllerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* No such route.
|
* No such route.
|
||||||
|
*
|
||||||
* @covers FireflyIII\Http\Controllers\HelpController::show
|
* @covers FireflyIII\Http\Controllers\HelpController::show
|
||||||
*/
|
*/
|
||||||
public function testGetHelpTextNoRoute()
|
public function testGetHelpTextNoRoute()
|
||||||
|
@ -233,16 +233,20 @@ class ReportHelperTest extends TestCase
|
|||||||
$left->save();
|
$left->save();
|
||||||
|
|
||||||
// save meta for account:
|
// save meta for account:
|
||||||
AccountMeta::create([
|
AccountMeta::create(
|
||||||
|
[
|
||||||
'account_id' => $left->id,
|
'account_id' => $left->id,
|
||||||
'name' => 'accountRole',
|
'name' => 'accountRole',
|
||||||
'data' => 'defaultAsset'
|
'data' => 'defaultAsset'
|
||||||
]);
|
]
|
||||||
AccountMeta::create([
|
);
|
||||||
|
AccountMeta::create(
|
||||||
|
[
|
||||||
'account_id' => $right->id,
|
'account_id' => $right->id,
|
||||||
'name' => 'accountRole',
|
'name' => 'accountRole',
|
||||||
'data' => 'defaultAsset'
|
'data' => 'defaultAsset'
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
for ($i = 0; $i < 5; $i++) {
|
for ($i = 0; $i < 5; $i++) {
|
||||||
@ -292,16 +296,20 @@ class ReportHelperTest extends TestCase
|
|||||||
$right->account_type_id = $asset->id;
|
$right->account_type_id = $asset->id;
|
||||||
|
|
||||||
// save meta for account:
|
// save meta for account:
|
||||||
AccountMeta::create([
|
AccountMeta::create(
|
||||||
|
[
|
||||||
'account_id' => $left->id,
|
'account_id' => $left->id,
|
||||||
'name' => 'accountRole',
|
'name' => 'accountRole',
|
||||||
'data' => 'defaultAsset'
|
'data' => 'defaultAsset'
|
||||||
]);
|
]
|
||||||
AccountMeta::create([
|
);
|
||||||
|
AccountMeta::create(
|
||||||
|
[
|
||||||
'account_id' => $right->id,
|
'account_id' => $right->id,
|
||||||
'name' => 'accountRole',
|
'name' => 'accountRole',
|
||||||
'data' => 'defaultAsset'
|
'data' => 'defaultAsset'
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
|
|
||||||
$right->save();
|
$right->save();
|
||||||
$left->save();
|
$left->save();
|
||||||
|
@ -38,24 +38,6 @@ class TagModelTest extends TestCase
|
|||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers FireflyIII\Models\Tag::firstOrCreateEncrypted
|
|
||||||
*/
|
|
||||||
public function testFirstOrCreateEncryptedNew()
|
|
||||||
{
|
|
||||||
$tag = FactoryMuffin::create('FireflyIII\Models\Tag');
|
|
||||||
|
|
||||||
$search = [
|
|
||||||
'tagMode' => 'something',
|
|
||||||
'tag' => 'Something else',
|
|
||||||
'user_id' => $tag->user_id,
|
|
||||||
];
|
|
||||||
|
|
||||||
$result = Tag::firstOrCreateEncrypted($search);
|
|
||||||
|
|
||||||
$this->assertNotEquals($tag->id, $result->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers FireflyIII\Models\Tag::firstOrCreateEncrypted
|
* @covers FireflyIII\Models\Tag::firstOrCreateEncrypted
|
||||||
*/
|
*/
|
||||||
@ -74,4 +56,22 @@ class TagModelTest extends TestCase
|
|||||||
$this->assertEquals($tag->id, $result->id);
|
$this->assertEquals($tag->id, $result->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers FireflyIII\Models\Tag::firstOrCreateEncrypted
|
||||||
|
*/
|
||||||
|
public function testFirstOrCreateEncryptedNew()
|
||||||
|
{
|
||||||
|
$tag = FactoryMuffin::create('FireflyIII\Models\Tag');
|
||||||
|
|
||||||
|
$search = [
|
||||||
|
'tagMode' => 'something',
|
||||||
|
'tag' => 'Something else',
|
||||||
|
'user_id' => $tag->user_id,
|
||||||
|
];
|
||||||
|
|
||||||
|
$result = Tag::firstOrCreateEncrypted($search);
|
||||||
|
|
||||||
|
$this->assertNotEquals($tag->id, $result->id);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user