mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 12:28:46 +00:00
Restore and fix API tests
This commit is contained in:
@@ -36,6 +36,7 @@ use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\View\View;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
@@ -94,7 +95,7 @@ class RegisterController extends Controller
|
||||
|
||||
$this->validator($request->all())->validate();
|
||||
$user = $this->createUser($request->all());
|
||||
app('log')->info(sprintf('Registered new user %s', $user->email));
|
||||
Log::info(sprintf('Registered new user %s', $user->email));
|
||||
$owner = new OwnerNotifiable();
|
||||
event(new RegisteredUser($owner, $user));
|
||||
|
||||
|
||||
@@ -464,7 +464,7 @@ class Navigation
|
||||
$displayFormat = (string) trans('config.month_and_day_js', [], $locale);
|
||||
$diff = $start->diffInMonths($end, true);
|
||||
// increment by month (for year)
|
||||
if ($diff >= 1.0001) {
|
||||
if ($diff >= 1.0001 && $diff < 12.001) {
|
||||
$increment = 'addMonth';
|
||||
$displayFormat = (string) trans('config.month_js');
|
||||
}
|
||||
@@ -495,7 +495,7 @@ class Navigation
|
||||
$format = 'Y-m-d';
|
||||
$diff = $start->diffInMonths($end, true);
|
||||
// Log::debug(sprintf('preferredCarbonFormat(%s, %s) = %f', $start->format('Y-m-d'), $end->format('Y-m-d'), $diff));
|
||||
if ($diff >= 1.001) {
|
||||
if ($diff >= 1.001 && $diff < 12.001) {
|
||||
// Log::debug(sprintf('Return Y-m because %s', $diff));
|
||||
$format = 'Y-m';
|
||||
}
|
||||
@@ -566,7 +566,7 @@ class Navigation
|
||||
{
|
||||
$locale = app('steam')->getLocale();
|
||||
$diff = $start->diffInMonths($end, true);
|
||||
if ($diff >= 1.001) {
|
||||
if ($diff >= 1.001 && $diff < 12.001) {
|
||||
return (string) trans('config.month_js', [], $locale);
|
||||
}
|
||||
|
||||
@@ -584,7 +584,7 @@ class Navigation
|
||||
public function preferredEndOfPeriod(Carbon $start, Carbon $end): string
|
||||
{
|
||||
$diff = $start->diffInMonths($end, true);
|
||||
if ($diff >= 1.001) {
|
||||
if ($diff >= 1.001 && $diff < 12.001) {
|
||||
return 'endOfMonth';
|
||||
}
|
||||
|
||||
@@ -602,7 +602,7 @@ class Navigation
|
||||
public function preferredRangeFormat(Carbon $start, Carbon $end): string
|
||||
{
|
||||
$diff = $start->diffInMonths($end, true);
|
||||
if ($diff >= 1.001) {
|
||||
if ($diff >= 1.001 && $diff < 12.001) {
|
||||
return '1M';
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ class Navigation
|
||||
public function preferredSqlFormat(Carbon $start, Carbon $end): string
|
||||
{
|
||||
$diff = $start->diffInMonths($end, true);
|
||||
if ($diff >= 1.001) {
|
||||
if ($diff >= 1.001 && $diff < 12.001) {
|
||||
return '%Y-%m';
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ trait UserGroupTrait
|
||||
if ($user instanceof User) {
|
||||
$this->user = $user;
|
||||
if (null === $user->userGroup) {
|
||||
throw new FireflyException(sprintf('User #%d has no user group.', $user->id));
|
||||
throw new FireflyException(sprintf('User #%d ("%s") has no user group.', $user->id, $user->email));
|
||||
}
|
||||
$this->userGroup = $user->userGroup;
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ class User extends Authenticatable
|
||||
use HasApiTokens;
|
||||
use Notifiable;
|
||||
use ReturnsIntegerIdTrait;
|
||||
protected $fillable = ['email', 'password', 'blocked', 'blocked_code'];
|
||||
protected $fillable = ['email', 'password', 'blocked', 'blocked_code','user_group_id'];
|
||||
protected $hidden = ['password', 'remember_token'];
|
||||
protected $table = 'users';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user