mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
🤖 Auto commit for release 'develop' on 2025-08-16
This commit is contained in:
@@ -28,8 +28,6 @@ use FireflyIII\Models\Bill;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\integration\TestCase;
|
||||
use FireflyIII\User;
|
||||
use FireflyIII\Models\UserGroup;
|
||||
use Override;
|
||||
|
||||
/**
|
||||
* Class BillControllerTest
|
||||
@@ -45,7 +43,6 @@ final class BillControllerTest extends TestCase
|
||||
*/
|
||||
use RefreshDatabase;
|
||||
|
||||
|
||||
private function createTestBills(int $count, User $user): void
|
||||
{
|
||||
for ($i = 1; $i <= $count; ++$i) {
|
||||
|
@@ -25,11 +25,9 @@ declare(strict_types=1);
|
||||
namespace Tests\integration\Api\Autocomplete;
|
||||
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\UserGroup;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\integration\TestCase;
|
||||
use FireflyIII\User;
|
||||
use Override;
|
||||
|
||||
/**
|
||||
* Class BudgetControllerTest
|
||||
|
@@ -25,13 +25,9 @@ declare(strict_types=1);
|
||||
namespace Tests\integration\Api\Autocomplete;
|
||||
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Models\UserRole;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\integration\TestCase;
|
||||
use FireflyIII\User;
|
||||
use FireflyIII\Models\UserGroup;
|
||||
use Override;
|
||||
|
||||
/**
|
||||
* Class CategoryControllerTest
|
||||
@@ -47,8 +43,6 @@ final class CategoryControllerTest extends TestCase
|
||||
*/
|
||||
use RefreshDatabase;
|
||||
|
||||
|
||||
|
||||
private function createTestCategories(int $count, User $user): void
|
||||
{
|
||||
for ($i = 1; $i <= $count; ++$i) {
|
||||
|
@@ -28,8 +28,6 @@ use FireflyIII\Models\TransactionCurrency;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\integration\TestCase;
|
||||
use FireflyIII\User;
|
||||
use FireflyIII\Models\UserGroup;
|
||||
use Override;
|
||||
|
||||
/**
|
||||
* Class CurrencyControllerTest
|
||||
@@ -45,7 +43,6 @@ final class CurrencyControllerTest extends TestCase
|
||||
*/
|
||||
use RefreshDatabase;
|
||||
|
||||
|
||||
private function createTestCurrencies(int $count, bool $enabled): void
|
||||
{
|
||||
for ($i = 1; $i <= $count; ++$i) {
|
||||
|
@@ -28,8 +28,6 @@ use FireflyIII\Models\ObjectGroup;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\integration\TestCase;
|
||||
use FireflyIII\User;
|
||||
use FireflyIII\Models\UserGroup;
|
||||
use Override;
|
||||
|
||||
/**
|
||||
* Class ObjectGroupControllerTest
|
||||
|
@@ -49,7 +49,7 @@ final class PiggyBankControllerTest extends TestCase
|
||||
|
||||
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) {
|
||||
$type = AccountType::create(['type' => AccountTypeEnum::DEFAULT->value]);
|
||||
}
|
||||
@@ -67,7 +67,7 @@ final class PiggyBankControllerTest extends TestCase
|
||||
$piggyBank = PiggyBank::create(
|
||||
[
|
||||
'user_id' => $user->id,
|
||||
'name' => 'Piggy bank ' . $i,
|
||||
'name' => 'Piggy bank '.$i,
|
||||
'target_amount' => 1000,
|
||||
'transaction_currency_id' => $currency->id,
|
||||
'target_date' => now()->addDays(30),
|
||||
@@ -78,7 +78,7 @@ final class PiggyBankControllerTest extends TestCase
|
||||
$account = Account::create(
|
||||
[
|
||||
'user_id' => $user->id,
|
||||
'name' => 'Account ' . $i,
|
||||
'name' => 'Account '.$i,
|
||||
'user_group_id' => $user->user_group_id,
|
||||
'account_type_id' => $type->id,
|
||||
'active' => 1,
|
||||
@@ -100,7 +100,7 @@ final class PiggyBankControllerTest extends TestCase
|
||||
public function testGivenAuthenticatedRequestWhenCallingTheBudgetsEndpointThenReturns200HttpCode(): void
|
||||
{
|
||||
// act as a user
|
||||
$user = $this->createAuthenticatedUser();
|
||||
$user = $this->createAuthenticatedUser();
|
||||
$this->actingAs($user);
|
||||
|
||||
$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
|
||||
{
|
||||
$user = $this->createAuthenticatedUser();
|
||||
$user = $this->createAuthenticatedUser();
|
||||
$this->actingAs($user);
|
||||
|
||||
$this->createTestPiggyBanks(5, $user);
|
||||
@@ -121,23 +121,23 @@ final class PiggyBankControllerTest extends TestCase
|
||||
$response->assertJsonCount(5);
|
||||
$response->assertJsonFragment(['name' => 'Piggy bank 1']);
|
||||
$response->assertJsonStructure([
|
||||
'*' => [
|
||||
'id',
|
||||
'name',
|
||||
],
|
||||
]);
|
||||
'*' => [
|
||||
'id',
|
||||
'name',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function testGivenAuthenticatedRequestWhenCallingTheBudgetsEndpointWithQueryThenReturnsBudgetsWithLimit(): void
|
||||
{
|
||||
$user = $this->createAuthenticatedUser();
|
||||
$user = $this->createAuthenticatedUser();
|
||||
$this->actingAs($user);
|
||||
|
||||
$this->createTestPiggyBanks(5, $user);
|
||||
$response = $this->get(route('api.v1.autocomplete.piggy-banks', [
|
||||
'query' => 'Piggy',
|
||||
'limit' => 3,
|
||||
]), ['Accept' => 'application/json']);
|
||||
]), ['Accept' => 'application/json']);
|
||||
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
@@ -146,14 +146,14 @@ final class PiggyBankControllerTest extends TestCase
|
||||
|
||||
public function testGivenAuthenticatedRequestWhenCallingTheBudgetsEndpointWithQueryThenReturnsBudgetsThatMatchQuery(): void
|
||||
{
|
||||
$user = $this->createAuthenticatedUser();
|
||||
$user = $this->createAuthenticatedUser();
|
||||
$this->actingAs($user);
|
||||
|
||||
$this->createTestPiggyBanks(20, $user);
|
||||
$response = $this->get(route('api.v1.autocomplete.piggy-banks', [
|
||||
'query' => 'Piggy bank 1',
|
||||
'limit' => 20,
|
||||
]), ['Accept' => 'application/json']);
|
||||
]), ['Accept' => 'application/json']);
|
||||
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
|
@@ -1,11 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\integration\Api\Chart;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\integration\TestCase;
|
||||
|
||||
class AccountControllerTest extends TestCase
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AccountControllerTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
private $user;
|
||||
@@ -28,14 +35,15 @@ class AccountControllerTest extends TestCase
|
||||
$response->assertStatus(422);
|
||||
|
||||
}
|
||||
|
||||
public function testGetOverviewChart(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
$params = [
|
||||
$params = [
|
||||
'start' => '2024-01-01',
|
||||
'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);
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\integration\Api\Chart;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\integration\TestCase;
|
||||
|
||||
class BalanceControllerTest extends TestCase
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class BalanceControllerTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
private $user;
|
||||
@@ -28,14 +35,15 @@ class BalanceControllerTest extends TestCase
|
||||
$response->assertStatus(422);
|
||||
|
||||
}
|
||||
|
||||
public function testGetOverviewChart(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
$params = [
|
||||
$params = [
|
||||
'start' => '2024-01-01',
|
||||
'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);
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\integration\Api\Chart;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\integration\TestCase;
|
||||
|
||||
class BudgetControllerTest extends TestCase
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class BudgetControllerTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
private $user;
|
||||
@@ -28,14 +35,15 @@ class BudgetControllerTest extends TestCase
|
||||
$response->assertStatus(422);
|
||||
|
||||
}
|
||||
|
||||
public function testGetOverviewChart(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
$params = [
|
||||
$params = [
|
||||
'start' => '2024-01-01',
|
||||
'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);
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\integration\Api\Chart;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\integration\TestCase;
|
||||
|
||||
class CategoryControllerTest extends TestCase
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CategoryControllerTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
private $user;
|
||||
@@ -28,14 +35,15 @@ class CategoryControllerTest extends TestCase
|
||||
$response->assertStatus(422);
|
||||
|
||||
}
|
||||
|
||||
public function testGetOverviewChart(): void
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
$params = [
|
||||
$params = [
|
||||
'start' => '2024-01-01',
|
||||
'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);
|
||||
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ abstract class TestCase extends BaseTestCase
|
||||
use RefreshDatabase;
|
||||
|
||||
protected const MAX_ITERATIONS = 2;
|
||||
protected $seed = true;
|
||||
protected $seed = true;
|
||||
|
||||
public function dateRangeProvider(): array
|
||||
{
|
||||
@@ -66,10 +66,10 @@ abstract class TestCase extends BaseTestCase
|
||||
$group = UserGroup::create(['title' => 'test@email.com']);
|
||||
$role = UserRole::where('title', 'owner')->first();
|
||||
$user = User::create([
|
||||
'email' => 'test@email.com',
|
||||
'password' => 'password',
|
||||
'user_group_id' => $group->id,
|
||||
]);
|
||||
'email' => 'test@email.com',
|
||||
'password' => 'password',
|
||||
'user_group_id' => $group->id,
|
||||
]);
|
||||
|
||||
GroupMembership::create(
|
||||
[
|
||||
@@ -82,6 +82,4 @@ abstract class TestCase extends BaseTestCase
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user