mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-20 03:08:11 +00:00
🤖 Auto commit for release 'develop' on 2025-08-16
This commit is contained in:
@@ -47,7 +47,7 @@ class AccountController extends Controller
|
|||||||
use CleansChartData;
|
use CleansChartData;
|
||||||
use CollectsAccountsFromFilter;
|
use CollectsAccountsFromFilter;
|
||||||
|
|
||||||
protected array $acceptedRoles = [UserRoleEnum::READ_ONLY];
|
protected array $acceptedRoles = [UserRoleEnum::READ_ONLY];
|
||||||
|
|
||||||
private array $chartData = [];
|
private array $chartData = [];
|
||||||
private AccountRepositoryInterface $repository;
|
private AccountRepositoryInterface $repository;
|
||||||
|
@@ -26,7 +26,6 @@ namespace FireflyIII\Api\V1\Controllers\Chart;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Api\V1\Requests\Data\DateRequest;
|
|
||||||
use FireflyIII\Api\V1\Requests\Data\SameDateRequest;
|
use FireflyIII\Api\V1\Requests\Data\SameDateRequest;
|
||||||
use FireflyIII\Enums\UserRoleEnum;
|
use FireflyIII\Enums\UserRoleEnum;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
@@ -26,7 +26,6 @@ namespace FireflyIII\Api\V1\Controllers\Chart;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Api\V1\Requests\Data\DateRequest;
|
|
||||||
use FireflyIII\Api\V1\Requests\Data\SameDateRequest;
|
use FireflyIII\Api\V1\Requests\Data\SameDateRequest;
|
||||||
use FireflyIII\Enums\AccountTypeEnum;
|
use FireflyIII\Enums\AccountTypeEnum;
|
||||||
use FireflyIII\Enums\TransactionTypeEnum;
|
use FireflyIII\Enums\TransactionTypeEnum;
|
||||||
|
@@ -46,6 +46,7 @@ use Illuminate\Http\JsonResponse;
|
|||||||
class PurgeController extends Controller
|
class PurgeController extends Controller
|
||||||
{
|
{
|
||||||
protected array $acceptedRoles = [UserRoleEnum::FULL];
|
protected array $acceptedRoles = [UserRoleEnum::FULL];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
@@ -42,7 +42,7 @@ class ValidatesEnvironmentVariables extends Command
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'integrity:validates-environment-variables';
|
protected $signature = 'integrity:validates-environment-variables';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
@@ -67,9 +67,9 @@ class ValidatesEnvironmentVariables extends Command
|
|||||||
|
|
||||||
private function validateLanguage(): bool
|
private function validateLanguage(): bool
|
||||||
{
|
{
|
||||||
$language = config('firefly.default_language');
|
$language = config('firefly.default_language');
|
||||||
$locale = config('firefly.default_locale');
|
$locale = config('firefly.default_locale');
|
||||||
$options = array_keys(config('firefly.languages'));
|
$options = array_keys(config('firefly.languages'));
|
||||||
|
|
||||||
if (!in_array($language, $options, true)) {
|
if (!in_array($language, $options, true)) {
|
||||||
$this->friendlyError(sprintf('DEFAULT_LANGUAGE "%s" is not a valid language for Firefly III.', $language));
|
$this->friendlyError(sprintf('DEFAULT_LANGUAGE "%s" is not a valid language for Firefly III.', $language));
|
||||||
@@ -86,6 +86,7 @@ class ValidatesEnvironmentVariables extends Command
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,8 +97,10 @@ class ValidatesEnvironmentVariables extends Command
|
|||||||
$this->friendlyError(sprintf('AUTHENTICATION_GUARD "%s" is not a valid guard for Firefly III.', $guard));
|
$this->friendlyError(sprintf('AUTHENTICATION_GUARD "%s" is not a valid guard for Firefly III.', $guard));
|
||||||
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
|
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
|
||||||
$this->friendlyError('Valid guards are: web, remote_user_guard');
|
$this->friendlyError('Valid guards are: web, remote_user_guard');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,8 +110,10 @@ class ValidatesEnvironmentVariables extends Command
|
|||||||
if ('' !== $token && 32 !== strlen($token)) {
|
if ('' !== $token && 32 !== strlen($token)) {
|
||||||
$this->friendlyError('STATIC_CRON_TOKEN must be empty or a 32-character string.');
|
$this->friendlyError('STATIC_CRON_TOKEN must be empty or a 32-character string.');
|
||||||
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
|
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@ use Illuminate\Support\Facades\Storage;
|
|||||||
use Safe\Exceptions\FileinfoException;
|
use Safe\Exceptions\FileinfoException;
|
||||||
use Safe\Exceptions\FilesystemException;
|
use Safe\Exceptions\FilesystemException;
|
||||||
use Safe\Exceptions\StringsException;
|
use Safe\Exceptions\StringsException;
|
||||||
|
|
||||||
use function Safe\file_put_contents;
|
use function Safe\file_put_contents;
|
||||||
use function Safe\md5_file;
|
use function Safe\md5_file;
|
||||||
use function Safe\mime_content_type;
|
use function Safe\mime_content_type;
|
||||||
@@ -45,10 +46,11 @@ class ScansAttachments extends Command
|
|||||||
|
|
||||||
protected $description = 'Rescan all attachments and re-set the correct MD5 hash and mime.';
|
protected $description = 'Rescan all attachments and re-set the correct MD5 hash and mime.';
|
||||||
|
|
||||||
protected $signature = 'firefly-iii:scan-attachments';
|
protected $signature = 'firefly-iii:scan-attachments';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
|
*
|
||||||
* @throws FilesystemException
|
* @throws FilesystemException
|
||||||
* @throws StringsException
|
* @throws StringsException
|
||||||
* @throws FileinfoException
|
* @throws FileinfoException
|
||||||
@@ -74,7 +76,7 @@ class ScansAttachments extends Command
|
|||||||
Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
|
Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
|
||||||
$decryptedContent = $encryptedContent;
|
$decryptedContent = $encryptedContent;
|
||||||
}
|
}
|
||||||
$tempFileName = tempnam(sys_get_temp_dir(), 'FireflyIII');
|
$tempFileName = tempnam(sys_get_temp_dir(), 'FireflyIII');
|
||||||
file_put_contents($tempFileName, $decryptedContent);
|
file_put_contents($tempFileName, $decryptedContent);
|
||||||
$attachment->md5 = (string)md5_file($tempFileName);
|
$attachment->md5 = (string)md5_file($tempFileName);
|
||||||
$attachment->mime = (string)mime_content_type($tempFileName);
|
$attachment->mime = (string)mime_content_type($tempFileName);
|
||||||
|
@@ -835,8 +835,10 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
if (count($product['transactions']) > 1) {
|
if (count($product['transactions']) > 1) {
|
||||||
return $product['title'];
|
return $product['title'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'zzz';
|
return 'zzz';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'zzz';
|
return 'zzz';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -66,16 +66,16 @@ class FrontpageChartGenerator
|
|||||||
public function generate(): array
|
public function generate(): array
|
||||||
{
|
{
|
||||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||||
$categories = $this->repository->getCategories();
|
$categories = $this->repository->getCategories();
|
||||||
$accounts = $this->accountRepos->getAccountsByType([AccountTypeEnum::DEBT->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::DEFAULT->value]);
|
$accounts = $this->accountRepos->getAccountsByType([AccountTypeEnum::DEBT->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::DEFAULT->value]);
|
||||||
$collection = $this->collectExpensesAll($categories, $accounts);
|
$collection = $this->collectExpensesAll($categories, $accounts);
|
||||||
|
|
||||||
// collect for no-category:
|
// collect for no-category:
|
||||||
$noCategory = $this->collectNoCatExpenses($accounts);
|
$noCategory = $this->collectNoCatExpenses($accounts);
|
||||||
$collection = array_merge($collection, $noCategory);
|
$collection = array_merge($collection, $noCategory);
|
||||||
|
|
||||||
// sort temp array by amount.
|
// sort temp array by amount.
|
||||||
$amounts = array_column($collection, 'sum_float');
|
$amounts = array_column($collection, 'sum_float');
|
||||||
array_multisort($amounts, SORT_ASC, $collection);
|
array_multisort($amounts, SORT_ASC, $collection);
|
||||||
|
|
||||||
$currencyData = $this->createCurrencyGroups($collection);
|
$currencyData = $this->createCurrencyGroups($collection);
|
||||||
@@ -168,6 +168,7 @@ class FrontpageChartGenerator
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $tempData;
|
return $tempData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -74,7 +74,7 @@ class User extends Authenticatable
|
|||||||
use HasApiTokens;
|
use HasApiTokens;
|
||||||
use Notifiable;
|
use Notifiable;
|
||||||
use ReturnsIntegerIdTrait;
|
use ReturnsIntegerIdTrait;
|
||||||
protected $fillable = ['email', 'password', 'blocked', 'blocked_code','user_group_id'];
|
protected $fillable = ['email', 'password', 'blocked', 'blocked_code', 'user_group_id'];
|
||||||
protected $hidden = ['password', 'remember_token'];
|
protected $hidden = ['password', 'remember_token'];
|
||||||
protected $table = 'users';
|
protected $table = 'users';
|
||||||
|
|
||||||
|
14
composer.lock
generated
14
composer.lock
generated
@@ -11771,16 +11771,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "12.3.4",
|
"version": "12.3.5",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "429095031bd38cb5070ca44166bd9dd5a9245dd6"
|
"reference": "f10ba5f12a256026ad3c7ee4894ffe47f60d7dc7"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/429095031bd38cb5070ca44166bd9dd5a9245dd6",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f10ba5f12a256026ad3c7ee4894ffe47f60d7dc7",
|
||||||
"reference": "429095031bd38cb5070ca44166bd9dd5a9245dd6",
|
"reference": "f10ba5f12a256026ad3c7ee4894ffe47f60d7dc7",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -11802,7 +11802,7 @@
|
|||||||
"sebastian/cli-parser": "^4.0.0",
|
"sebastian/cli-parser": "^4.0.0",
|
||||||
"sebastian/comparator": "^7.1.2",
|
"sebastian/comparator": "^7.1.2",
|
||||||
"sebastian/diff": "^7.0.0",
|
"sebastian/diff": "^7.0.0",
|
||||||
"sebastian/environment": "^8.0.2",
|
"sebastian/environment": "^8.0.3",
|
||||||
"sebastian/exporter": "^7.0.0",
|
"sebastian/exporter": "^7.0.0",
|
||||||
"sebastian/global-state": "^8.0.0",
|
"sebastian/global-state": "^8.0.0",
|
||||||
"sebastian/object-enumerator": "^7.0.0",
|
"sebastian/object-enumerator": "^7.0.0",
|
||||||
@@ -11848,7 +11848,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.3.4"
|
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.3.5"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -11872,7 +11872,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2025-08-12T07:35:30+00:00"
|
"time": "2025-08-16T05:20:09+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "rector/rector",
|
"name": "rector/rector",
|
||||||
|
@@ -79,7 +79,7 @@ return [
|
|||||||
// see cer.php for exchange rates feature flag.
|
// see cer.php for exchange rates feature flag.
|
||||||
],
|
],
|
||||||
'version' => 'develop/2025-08-16',
|
'version' => 'develop/2025-08-16',
|
||||||
'build_time' => 1755317476,
|
'build_time' => 1755365689,
|
||||||
'api_version' => '2.1.0', // field is no longer used.
|
'api_version' => '2.1.0', // field is no longer used.
|
||||||
'db_version' => 26,
|
'db_version' => 26,
|
||||||
|
|
||||||
|
@@ -28,8 +28,6 @@ use FireflyIII\Models\Bill;
|
|||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Tests\integration\TestCase;
|
use Tests\integration\TestCase;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use FireflyIII\Models\UserGroup;
|
|
||||||
use Override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BillControllerTest
|
* Class BillControllerTest
|
||||||
@@ -45,7 +43,6 @@ final class BillControllerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
|
||||||
private function createTestBills(int $count, User $user): void
|
private function createTestBills(int $count, User $user): void
|
||||||
{
|
{
|
||||||
for ($i = 1; $i <= $count; ++$i) {
|
for ($i = 1; $i <= $count; ++$i) {
|
||||||
|
@@ -25,11 +25,9 @@ declare(strict_types=1);
|
|||||||
namespace Tests\integration\Api\Autocomplete;
|
namespace Tests\integration\Api\Autocomplete;
|
||||||
|
|
||||||
use FireflyIII\Models\Budget;
|
use FireflyIII\Models\Budget;
|
||||||
use FireflyIII\Models\UserGroup;
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Tests\integration\TestCase;
|
use Tests\integration\TestCase;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BudgetControllerTest
|
* Class BudgetControllerTest
|
||||||
|
@@ -25,13 +25,9 @@ declare(strict_types=1);
|
|||||||
namespace Tests\integration\Api\Autocomplete;
|
namespace Tests\integration\Api\Autocomplete;
|
||||||
|
|
||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Models\UserRole;
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Tests\integration\TestCase;
|
use Tests\integration\TestCase;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use FireflyIII\Models\UserGroup;
|
|
||||||
use Override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CategoryControllerTest
|
* Class CategoryControllerTest
|
||||||
@@ -47,8 +43,6 @@ final class CategoryControllerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function createTestCategories(int $count, User $user): void
|
private function createTestCategories(int $count, User $user): void
|
||||||
{
|
{
|
||||||
for ($i = 1; $i <= $count; ++$i) {
|
for ($i = 1; $i <= $count; ++$i) {
|
||||||
|
@@ -28,8 +28,6 @@ use FireflyIII\Models\TransactionCurrency;
|
|||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Tests\integration\TestCase;
|
use Tests\integration\TestCase;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use FireflyIII\Models\UserGroup;
|
|
||||||
use Override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CurrencyControllerTest
|
* Class CurrencyControllerTest
|
||||||
@@ -45,7 +43,6 @@ final class CurrencyControllerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
|
||||||
private function createTestCurrencies(int $count, bool $enabled): void
|
private function createTestCurrencies(int $count, bool $enabled): void
|
||||||
{
|
{
|
||||||
for ($i = 1; $i <= $count; ++$i) {
|
for ($i = 1; $i <= $count; ++$i) {
|
||||||
|
@@ -28,8 +28,6 @@ use FireflyIII\Models\ObjectGroup;
|
|||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Tests\integration\TestCase;
|
use Tests\integration\TestCase;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use FireflyIII\Models\UserGroup;
|
|
||||||
use Override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ObjectGroupControllerTest
|
* Class ObjectGroupControllerTest
|
||||||
|
@@ -49,7 +49,7 @@ final class PiggyBankControllerTest extends TestCase
|
|||||||
|
|
||||||
private function createTestPiggyBanks(int $count, User $user): void
|
private function createTestPiggyBanks(int $count, User $user): void
|
||||||
{
|
{
|
||||||
$type = AccountType::whereType(AccountTypeEnum::DEFAULT->value)->first();
|
$type = AccountType::whereType(AccountTypeEnum::DEFAULT->value)->first();
|
||||||
if (null === $type) {
|
if (null === $type) {
|
||||||
$type = AccountType::create(['type' => AccountTypeEnum::DEFAULT->value]);
|
$type = AccountType::create(['type' => AccountTypeEnum::DEFAULT->value]);
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ final class PiggyBankControllerTest extends TestCase
|
|||||||
$piggyBank = PiggyBank::create(
|
$piggyBank = PiggyBank::create(
|
||||||
[
|
[
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'name' => 'Piggy bank ' . $i,
|
'name' => 'Piggy bank '.$i,
|
||||||
'target_amount' => 1000,
|
'target_amount' => 1000,
|
||||||
'transaction_currency_id' => $currency->id,
|
'transaction_currency_id' => $currency->id,
|
||||||
'target_date' => now()->addDays(30),
|
'target_date' => now()->addDays(30),
|
||||||
@@ -78,7 +78,7 @@ final class PiggyBankControllerTest extends TestCase
|
|||||||
$account = Account::create(
|
$account = Account::create(
|
||||||
[
|
[
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'name' => 'Account ' . $i,
|
'name' => 'Account '.$i,
|
||||||
'user_group_id' => $user->user_group_id,
|
'user_group_id' => $user->user_group_id,
|
||||||
'account_type_id' => $type->id,
|
'account_type_id' => $type->id,
|
||||||
'active' => 1,
|
'active' => 1,
|
||||||
@@ -100,7 +100,7 @@ final class PiggyBankControllerTest extends TestCase
|
|||||||
public function testGivenAuthenticatedRequestWhenCallingTheBudgetsEndpointThenReturns200HttpCode(): void
|
public function testGivenAuthenticatedRequestWhenCallingTheBudgetsEndpointThenReturns200HttpCode(): void
|
||||||
{
|
{
|
||||||
// act as a user
|
// act as a user
|
||||||
$user = $this->createAuthenticatedUser();
|
$user = $this->createAuthenticatedUser();
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
$response = $this->get(route('api.v1.autocomplete.piggy-banks'), ['Accept' => 'application/json']);
|
$response = $this->get(route('api.v1.autocomplete.piggy-banks'), ['Accept' => 'application/json']);
|
||||||
@@ -111,7 +111,7 @@ final class PiggyBankControllerTest extends TestCase
|
|||||||
|
|
||||||
public function testGivenAuthenticatedRequestWhenCallingTheBudgetsEndpointThenReturnsBudgets(): void
|
public function testGivenAuthenticatedRequestWhenCallingTheBudgetsEndpointThenReturnsBudgets(): void
|
||||||
{
|
{
|
||||||
$user = $this->createAuthenticatedUser();
|
$user = $this->createAuthenticatedUser();
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
$this->createTestPiggyBanks(5, $user);
|
$this->createTestPiggyBanks(5, $user);
|
||||||
@@ -121,23 +121,23 @@ final class PiggyBankControllerTest extends TestCase
|
|||||||
$response->assertJsonCount(5);
|
$response->assertJsonCount(5);
|
||||||
$response->assertJsonFragment(['name' => 'Piggy bank 1']);
|
$response->assertJsonFragment(['name' => 'Piggy bank 1']);
|
||||||
$response->assertJsonStructure([
|
$response->assertJsonStructure([
|
||||||
'*' => [
|
'*' => [
|
||||||
'id',
|
'id',
|
||||||
'name',
|
'name',
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGivenAuthenticatedRequestWhenCallingTheBudgetsEndpointWithQueryThenReturnsBudgetsWithLimit(): void
|
public function testGivenAuthenticatedRequestWhenCallingTheBudgetsEndpointWithQueryThenReturnsBudgetsWithLimit(): void
|
||||||
{
|
{
|
||||||
$user = $this->createAuthenticatedUser();
|
$user = $this->createAuthenticatedUser();
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
$this->createTestPiggyBanks(5, $user);
|
$this->createTestPiggyBanks(5, $user);
|
||||||
$response = $this->get(route('api.v1.autocomplete.piggy-banks', [
|
$response = $this->get(route('api.v1.autocomplete.piggy-banks', [
|
||||||
'query' => 'Piggy',
|
'query' => 'Piggy',
|
||||||
'limit' => 3,
|
'limit' => 3,
|
||||||
]), ['Accept' => 'application/json']);
|
]), ['Accept' => 'application/json']);
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertHeader('Content-Type', 'application/json');
|
$response->assertHeader('Content-Type', 'application/json');
|
||||||
@@ -146,14 +146,14 @@ final class PiggyBankControllerTest extends TestCase
|
|||||||
|
|
||||||
public function testGivenAuthenticatedRequestWhenCallingTheBudgetsEndpointWithQueryThenReturnsBudgetsThatMatchQuery(): void
|
public function testGivenAuthenticatedRequestWhenCallingTheBudgetsEndpointWithQueryThenReturnsBudgetsThatMatchQuery(): void
|
||||||
{
|
{
|
||||||
$user = $this->createAuthenticatedUser();
|
$user = $this->createAuthenticatedUser();
|
||||||
$this->actingAs($user);
|
$this->actingAs($user);
|
||||||
|
|
||||||
$this->createTestPiggyBanks(20, $user);
|
$this->createTestPiggyBanks(20, $user);
|
||||||
$response = $this->get(route('api.v1.autocomplete.piggy-banks', [
|
$response = $this->get(route('api.v1.autocomplete.piggy-banks', [
|
||||||
'query' => 'Piggy bank 1',
|
'query' => 'Piggy bank 1',
|
||||||
'limit' => 20,
|
'limit' => 20,
|
||||||
]), ['Accept' => 'application/json']);
|
]), ['Accept' => 'application/json']);
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertHeader('Content-Type', 'application/json');
|
$response->assertHeader('Content-Type', 'application/json');
|
||||||
|
@@ -1,11 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tests\integration\Api\Chart;
|
namespace Tests\integration\Api\Chart;
|
||||||
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Tests\integration\TestCase;
|
use Tests\integration\TestCase;
|
||||||
|
|
||||||
class AccountControllerTest extends TestCase
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class AccountControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
private $user;
|
private $user;
|
||||||
@@ -28,14 +35,15 @@ class AccountControllerTest extends TestCase
|
|||||||
$response->assertStatus(422);
|
$response->assertStatus(422);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetOverviewChart(): void
|
public function testGetOverviewChart(): void
|
||||||
{
|
{
|
||||||
$this->actingAs($this->user);
|
$this->actingAs($this->user);
|
||||||
$params = [
|
$params = [
|
||||||
'start' => '2024-01-01',
|
'start' => '2024-01-01',
|
||||||
'end' => '2024-01-31',
|
'end' => '2024-01-31',
|
||||||
];
|
];
|
||||||
$response = $this->getJson(route('api.v1.chart.account.overview') . '?' . http_build_query($params));
|
$response = $this->getJson(route('api.v1.chart.account.overview').'?'.http_build_query($params));
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tests\integration\Api\Chart;
|
namespace Tests\integration\Api\Chart;
|
||||||
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Tests\integration\TestCase;
|
use Tests\integration\TestCase;
|
||||||
|
|
||||||
class BalanceControllerTest extends TestCase
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class BalanceControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
private $user;
|
private $user;
|
||||||
@@ -28,14 +35,15 @@ class BalanceControllerTest extends TestCase
|
|||||||
$response->assertStatus(422);
|
$response->assertStatus(422);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetOverviewChart(): void
|
public function testGetOverviewChart(): void
|
||||||
{
|
{
|
||||||
$this->actingAs($this->user);
|
$this->actingAs($this->user);
|
||||||
$params = [
|
$params = [
|
||||||
'start' => '2024-01-01',
|
'start' => '2024-01-01',
|
||||||
'end' => '2024-01-31',
|
'end' => '2024-01-31',
|
||||||
];
|
];
|
||||||
$response = $this->getJson(route('api.v1.chart.balance.balance') . '?' . http_build_query($params));
|
$response = $this->getJson(route('api.v1.chart.balance.balance').'?'.http_build_query($params));
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tests\integration\Api\Chart;
|
namespace Tests\integration\Api\Chart;
|
||||||
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Tests\integration\TestCase;
|
use Tests\integration\TestCase;
|
||||||
|
|
||||||
class BudgetControllerTest extends TestCase
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class BudgetControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
private $user;
|
private $user;
|
||||||
@@ -28,14 +35,15 @@ class BudgetControllerTest extends TestCase
|
|||||||
$response->assertStatus(422);
|
$response->assertStatus(422);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetOverviewChart(): void
|
public function testGetOverviewChart(): void
|
||||||
{
|
{
|
||||||
$this->actingAs($this->user);
|
$this->actingAs($this->user);
|
||||||
$params = [
|
$params = [
|
||||||
'start' => '2024-01-01',
|
'start' => '2024-01-01',
|
||||||
'end' => '2024-01-31',
|
'end' => '2024-01-31',
|
||||||
];
|
];
|
||||||
$response = $this->getJson(route('api.v1.chart.budget.overview') . '?' . http_build_query($params));
|
$response = $this->getJson(route('api.v1.chart.budget.overview').'?'.http_build_query($params));
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tests\integration\Api\Chart;
|
namespace Tests\integration\Api\Chart;
|
||||||
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Tests\integration\TestCase;
|
use Tests\integration\TestCase;
|
||||||
|
|
||||||
class CategoryControllerTest extends TestCase
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class CategoryControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
private $user;
|
private $user;
|
||||||
@@ -28,14 +35,15 @@ class CategoryControllerTest extends TestCase
|
|||||||
$response->assertStatus(422);
|
$response->assertStatus(422);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetOverviewChart(): void
|
public function testGetOverviewChart(): void
|
||||||
{
|
{
|
||||||
$this->actingAs($this->user);
|
$this->actingAs($this->user);
|
||||||
$params = [
|
$params = [
|
||||||
'start' => '2024-01-01',
|
'start' => '2024-01-01',
|
||||||
'end' => '2024-01-31',
|
'end' => '2024-01-31',
|
||||||
];
|
];
|
||||||
$response = $this->getJson(route('api.v1.chart.category.overview') . '?' . http_build_query($params));
|
$response = $this->getJson(route('api.v1.chart.category.overview').'?'.http_build_query($params));
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -41,7 +41,7 @@ abstract class TestCase extends BaseTestCase
|
|||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
protected const MAX_ITERATIONS = 2;
|
protected const MAX_ITERATIONS = 2;
|
||||||
protected $seed = true;
|
protected $seed = true;
|
||||||
|
|
||||||
public function dateRangeProvider(): array
|
public function dateRangeProvider(): array
|
||||||
{
|
{
|
||||||
@@ -66,10 +66,10 @@ abstract class TestCase extends BaseTestCase
|
|||||||
$group = UserGroup::create(['title' => 'test@email.com']);
|
$group = UserGroup::create(['title' => 'test@email.com']);
|
||||||
$role = UserRole::where('title', 'owner')->first();
|
$role = UserRole::where('title', 'owner')->first();
|
||||||
$user = User::create([
|
$user = User::create([
|
||||||
'email' => 'test@email.com',
|
'email' => 'test@email.com',
|
||||||
'password' => 'password',
|
'password' => 'password',
|
||||||
'user_group_id' => $group->id,
|
'user_group_id' => $group->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
GroupMembership::create(
|
GroupMembership::create(
|
||||||
[
|
[
|
||||||
@@ -82,6 +82,4 @@ abstract class TestCase extends BaseTestCase
|
|||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user