Update casters
This commit is contained in:
parent
aa862f1264
commit
7c876d75c9
|
@ -17,9 +17,6 @@ class CarbonCast implements Cast
|
|||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $context
|
||||
*/
|
||||
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): DateTimeInterface|Uncastable|null
|
||||
{
|
||||
if ($property->type->isNullable && !$value) {
|
||||
|
@ -27,7 +24,7 @@ class CarbonCast implements Cast
|
|||
}
|
||||
|
||||
try {
|
||||
return (new DateTimeInterfaceCast($this->format, null, null, null))->cast($property, $value, $context);
|
||||
return (new DateTimeInterfaceCast($this->format, null, null, null))->cast($property, $value, $properties, $context);
|
||||
} catch (CannotCastDate $e) {
|
||||
if (!$property->type->isNullable) {
|
||||
throw $e;
|
||||
|
|
|
@ -12,9 +12,6 @@ class GroupCast implements Cast
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $context
|
||||
*/
|
||||
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): ?string
|
||||
{
|
||||
if ($property->type->isNullable && !$value) {
|
||||
|
|
|
@ -15,9 +15,6 @@ class NullValueCast implements Cast
|
|||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $context
|
||||
*/
|
||||
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): DateTimeInterface|Uncastable|null|int
|
||||
{
|
||||
if ($this->id === $value) {
|
||||
|
|
|
@ -12,9 +12,6 @@ class StringCast implements Cast
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $context
|
||||
*/
|
||||
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): ?string
|
||||
{
|
||||
if ($property->type->isNullable && !$value) {
|
||||
|
|
|
@ -11,7 +11,7 @@ class PutMemberTest extends TestCase
|
|||
public function testPushASingleMember(): void
|
||||
{
|
||||
app(MemberFake::class)->stores(103, 16);
|
||||
$member = Member::factory()->toMember([
|
||||
$member = Member::toFactory()->toMember([
|
||||
'firstname' => 'Max',
|
||||
'lastname' => 'Nach1',
|
||||
'nickname' => 'spitz1',
|
||||
|
@ -79,7 +79,7 @@ class PutMemberTest extends TestCase
|
|||
app(MemberFake::class)
|
||||
->updatesSuccessfully(103, 16)
|
||||
->shows(103, 16);
|
||||
$member = Member::factory()->toMember([
|
||||
$member = Member::toFactory()->toMember([
|
||||
'firstname' => 'Max',
|
||||
'lastname' => 'Nach1',
|
||||
'nickname' => 'spitz1',
|
||||
|
@ -123,7 +123,7 @@ class PutMemberTest extends TestCase
|
|||
app(MemberFake::class)
|
||||
->updatesSuccessfully(103, 16)
|
||||
->shows(103, 16);
|
||||
$member = Member::factory()->toMember([
|
||||
$member = Member::toFactory()->toMember([
|
||||
'email' => null,
|
||||
'groupId' => 103,
|
||||
'id' => 16,
|
||||
|
@ -145,7 +145,7 @@ class PutMemberTest extends TestCase
|
|||
'foreign' => 'fff',
|
||||
'kontoverbindung' => ['a' => 'b'],
|
||||
]);
|
||||
$response = $this->login()->putMember(Member::factory()->inNami(103, 16)->toMember());
|
||||
$response = $this->login()->putMember(Member::toFactory()->inNami(103, 16)->toMember());
|
||||
|
||||
$this->assertEquals(16, $response);
|
||||
|
||||
|
@ -163,7 +163,7 @@ class PutMemberTest extends TestCase
|
|||
'foreign' => 'fff',
|
||||
'kontoverbindung' => ['a' => 'b'],
|
||||
]);
|
||||
$response = $this->login()->putMember(Member::factory()->inNami(103, 16)->toMember(['genderId' => null, 'regionId' => null]));
|
||||
$response = $this->login()->putMember(Member::toFactory()->inNami(103, 16)->toMember(['genderId' => null, 'regionId' => null]));
|
||||
|
||||
$this->assertEquals(16, $response);
|
||||
|
||||
|
|
Loading…
Reference in New Issue