Fix tests
continuous-integration/drone/push Build is failing Details

This commit is contained in:
philipp lang 2024-09-22 17:32:29 +02:00
parent a5f1c90003
commit d30a2336cf
33 changed files with 69 additions and 30 deletions

View File

@ -1,4 +1,4 @@
FROM php:8.1.6-fpm as php
FROM php:8.3.11-fpm as php
WORKDIR /app
RUN ls /app
RUN apt-get update

View File

@ -4,12 +4,14 @@ namespace App;
use App\Nami\HasNamiField;
use Cviebrock\EloquentSluggable\Sluggable;
use Database\Factories\ActivityFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Activity extends Model
{
/** @use HasFactory<ActivityFactory> */
use HasFactory;
use HasNamiField;
use Sluggable;

View File

@ -2,11 +2,13 @@
namespace App;
use Database\Factories\ConfessionFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Confession extends Model
{
/** @use HasFactory<ConfessionFactory> */
use HasFactory;
public $fillable = ['name', 'nami_id', 'is_null'];

View File

@ -74,7 +74,7 @@ class BdkjHesse extends ContributionDocument
public function durationDays(): int
{
return Carbon::parse($this->dateUntil)->diffInDays(Carbon::parse($this->dateFrom)) + 1;
return intVal(Carbon::parse($this->dateUntil)->diffInDays(Carbon::parse($this->dateFrom))) + 1;
}
/**

View File

@ -3,11 +3,13 @@
namespace App;
use App\Nami\HasNamiField;
use Database\Factories\CountryFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Country extends Model
{
/** @use HasFactory<CountryFactory> */
use HasFactory;
use HasNamiField;

View File

@ -3,11 +3,13 @@
namespace App\Course\Models;
use App\Nami\HasNamiField;
use Database\Factories\Course\Models\CourseFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Course extends Model
{
/** @use HasFactory<CourseFactory> */
use HasFactory;
use HasNamiField;

View File

@ -3,12 +3,14 @@
namespace App\Course\Models;
use App\Member\Member;
use Database\Factories\Course\Models\CourseMemberFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CourseMember extends Model
{
/** @use HasFactory<CourseMemberFactory> */
use HasFactory;
/** @var array<int, string> */

View File

@ -4,12 +4,14 @@ namespace App;
use App\Nami\HasNamiField;
use App\Payment\Subscription;
use Database\Factories\FeeFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Fee extends Model
{
/** @use HasFactory<FeeFactory> */
use HasFactory;
use HasNamiField;

View File

@ -3,11 +3,13 @@
namespace App\Fileshare\Models;
use App\Fileshare\ConnectionTypes\ConnectionType;
use Database\Factories\Fileshare\Models\FileshareFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Fileshare extends Model
{
/** @use HasFactory<FileshareFactory> */
use HasFactory;
public $guarded = [];

View File

@ -21,7 +21,6 @@ class CollectionCast implements Cast
/**
* @param array<int, array<string, mixed>> $value
* @param array<string, mixed> $context
* @return Collection<int, Data>
*/
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): mixed

View File

@ -12,7 +12,6 @@ class FieldCollectionCast implements Cast
{
/**
* @param array<int, array<string, string>> $value
* @param array<string, mixed> $context
* @return FieldCollection
*/
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): mixed

View File

@ -8,6 +8,7 @@ use App\Form\Data\FormConfigData;
use App\Lib\Editor\Condition;
use App\Lib\Editor\EditorData;
use Cviebrock\EloquentSluggable\Sluggable;
use Database\Factories\Form\Models\FormFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
@ -22,6 +23,7 @@ use Zoomyboy\MedialibraryHelper\DefersUploads;
/** @todo replace editor content with EditorData cast */
class Form extends Model implements HasMedia
{
/** @use HasFactory<FormFactory> */
use HasFactory;
use Sluggable;
use InteractsWithMedia;

View File

@ -4,6 +4,7 @@ namespace App\Form\Models;
use App\Form\Data\FormConfigData;
use App\Lib\Editor\EditorData;
use Database\Factories\Form\Models\FormtemplateFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@ -12,6 +13,7 @@ use Illuminate\Database\Eloquent\Model;
*/
class Formtemplate extends Model
{
/** @use HasFactory<FormtemplateFactory> */
use HasFactory;
public $guarded = [];

View File

@ -8,6 +8,7 @@ use App\Form\Mails\ConfirmRegistrationMail;
use App\Form\Scopes\ParticipantFilterScope;
use App\Member\Member;
use App\Prevention\Contracts\Preventable;
use Database\Factories\Form\Models\ParticipantFactory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@ -18,6 +19,8 @@ use stdClass;
class Participant extends Model implements Preventable
{
/** @use HasFactory<ParticipantFactory> */
use HasFactory;
public $guarded = [];

View File

@ -3,12 +3,15 @@
namespace App;
use App\Nami\HasNamiField;
use Database\Factories\GenderFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Gender extends Model
{
use HasNamiField;
/** @use HasFactory<GenderFactory> */
use HasFactory;
public $fillable = ['name', 'nami_id'];

View File

@ -5,6 +5,7 @@ namespace App;
use App\Fileshare\Data\FileshareResourceData;
use App\Group\Enums\Level;
use App\Nami\HasNamiField;
use Database\Factories\GroupFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@ -12,6 +13,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class Group extends Model
{
/** @use HasFactory<GroupFactory> */
use HasFactory;
use HasNamiField;
@ -24,11 +26,11 @@ class Group extends Model
];
/**
* @return BelongsTo<static, self>
* @return BelongsTo<self, self>
*/
public function parent(): BelongsTo
{
return $this->belongsTo(static::class, 'parent_id');
return $this->belongsTo(self::class, 'parent_id');
}
/**
@ -36,7 +38,7 @@ class Group extends Model
*/
public function children(): HasMany
{
return $this->hasMany(static::class, 'parent_id');
return $this->hasMany(self::class, 'parent_id');
}
public static function booted(): void

View File

@ -11,6 +11,7 @@ use App\Invoice\RememberDocument;
use App\Invoice\Scopes\InvoiceFilterScope;
use App\Member\Member;
use App\Payment\Subscription;
use Database\Factories\Invoice\Models\InvoiceFactory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@ -20,6 +21,7 @@ use stdClass;
class Invoice extends Model
{
/** @use HasFactory<InvoiceFactory> */
use HasFactory;
public $guarded = [];

View File

@ -3,12 +3,14 @@
namespace App\Invoice\Models;
use App\Member\Member;
use Database\Factories\Invoice\Models\InvoicePositionFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class InvoicePosition extends Model
{
/** @use HasFactory<InvoicePositionFactory> */
use HasFactory;
public $guarded = [];

View File

@ -14,9 +14,11 @@ abstract class ScoutFilter extends Data
{
/**
* @return Builder
* @return Builder<T>
*/
abstract public function getQuery(): Builder;
/** @var Builder<T> */
protected Builder $query;
/**

View File

@ -8,7 +8,6 @@ use Illuminate\Database\Eloquent\Model;
class Localmaildispatcher extends Model
{
use HasFactory;
use HasUuids;
public $guarded = [];

View File

@ -3,6 +3,7 @@
namespace App\Maildispatcher\Models;
use App\Mailgateway\Models\Mailgateway;
use Database\Factories\Maildispatcher\Models\MaildispatcherFactory;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@ -10,6 +11,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Maildispatcher extends Model
{
/** @use HasFactory<MaildispatcherFactory> */
use HasFactory;
use HasUuids;

View File

@ -3,12 +3,14 @@
namespace App\Mailgateway\Models;
use App\Mailgateway\Casts\TypeCast;
use Database\Factories\Mailgateway\Models\MailgatewayFactory;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Mailgateway extends Model
{
/** @use HasFactory<MailgatewayFactory> */
use HasFactory;
use HasUuids;

View File

@ -33,6 +33,7 @@ use Zoomyboy\Osm\Geolocatable;
use Zoomyboy\Osm\HasGeolocation;
use Zoomyboy\Phone\HasPhoneNumbers;
use App\Prevention\Enums\Prevention;
use Database\Factories\Member\MemberFactory;
/**
* @property string $subscription_name
@ -42,6 +43,7 @@ class Member extends Model implements Geolocatable
{
use Notifiable;
use HasNamiField;
/** @use HasFactory<MemberFactory> */
use HasFactory;
use Sluggable;
use Searchable;
@ -182,7 +184,7 @@ class Member extends Model implements Geolocatable
public function getAge(): ?int
{
return $this->birthday?->diffInYears(now());
return $this->birthday ? intval($this->birthday->diffInYears(now())) : null;
}
protected function getAusstand(): int
@ -406,14 +408,14 @@ class Member extends Model implements Geolocatable
return $query->where('group_id', $group->id);
}
public static function fromVcard(string $url, string $data): static
public static function fromVcard(string $url, string $data): self
{
$settings = app(NamiSettings::class);
$card = Reader::read($data);
[$lastname, $firstname] = $card->N->getParts();
[$deprecated1, $deprecated2, $address, $location, $region, $zip, $country] = $card->ADR->getParts();
return new static([
return new self([
'joined_at' => now(),
'send_newspaper' => false,
'firstname' => $firstname,

View File

@ -6,6 +6,7 @@ use App\Activity;
use App\Group;
use App\Nami\HasNamiField;
use App\Subactivity;
use Database\Factories\Member\MembershipFactory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@ -16,6 +17,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
*/
class Membership extends Model
{
/** @use HasFactory<MembershipFactory> */
use HasFactory;
use HasNamiField;

View File

@ -13,8 +13,8 @@ class TestersBlock extends Block
*/
public function query(): Builder
{
return Member::whereHas('memberships', fn ($q) => $q->isTrying())
->with('memberships', fn ($q) => $q->isTrying());
return Member::with('memberships', fn ($q) => $q->isTrying())
->whereHas('memberships', fn ($q) => $q->isTrying());
}
/**

View File

@ -3,11 +3,13 @@
namespace App;
use App\Nami\HasNamiField;
use Database\Factories\NationalityFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Nationality extends Model
{
/** @use HasFactory<NationalityFactory> */
use HasFactory;
use HasNamiField;

View File

@ -3,6 +3,7 @@
namespace App\Payment;
use App\Fee;
use Database\Factories\Payment\SubscriptionFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@ -10,6 +11,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class Subscription extends Model
{
/** @use HasFactory<SubscriptionFactory> */
use HasFactory;
/**

View File

@ -2,12 +2,14 @@
namespace App\Payment;
use Database\Factories\Payment\SubscriptionChildFactory;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SubscriptionChild extends Model
{
/** @use HasFactory<SubscriptionChildFactory> */
use HasFactory;
use HasUuids;

View File

@ -2,12 +2,14 @@
namespace App;
use Database\Factories\RegionFactory;
use Illuminate\Support\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Region extends Model
{
/** @use HasFactory<RegionFactory> */
use HasFactory;
public $timestamps = false;

View File

@ -4,12 +4,14 @@ namespace App;
use App\Nami\HasNamiField;
use Cviebrock\EloquentSluggable\Sluggable;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Subactivity extends Model
{
/** @use HasFactory<UserFactory> */
use HasFactory;
use HasNamiField;
use Sluggable;

View File

@ -3,12 +3,14 @@
namespace App;
use App\Auth\ResetPassword;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<UserFactory> */
use HasFactory;
use Notifiable;

@ -1 +1 @@
Subproject commit 3f5321af9d6d48e1e50d6041548abfb74e594de0
Subproject commit bc61530e510b3d41048984b7cf20b6d82c4f85fb

View File

@ -28,6 +28,11 @@ parameters:
AddressBookCard: 'array{lastmodified: int, etag: string, uri: string, id: int, size: int}'
ignoreErrors:
-
message: "#but does not specify its types: TData#"
-
message: "#cast\\(\\) has parameter \\$properties#"
-
message: "#^Method App\\\\Activity\\:\\:sluggable\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
@ -58,11 +63,6 @@ parameters:
count: 1
path: app/Member/Member.php
-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: app/Member/Member.php
-
message: "#^Method App\\\\Member\\\\MemberRequest\\:\\:rules\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
@ -393,16 +393,6 @@ parameters:
count: 1
path: tests/Feature/Member/DavTest.php
-
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$email\\.$#"
count: 2
path: app/Maildispatcher/Actions/ResyncAction.php
-
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$email_parents\\.$#"
count: 2
path: app/Maildispatcher/Actions/ResyncAction.php
-
message: "#^Unable to resolve the template type TKey in call to function collect$#"
count: 2