Skip to content

Commit

Permalink
Improve test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Dec 12, 2023
1 parent cc27504 commit 6dc3424
Showing 1 changed file with 12 additions and 36 deletions.
48 changes: 12 additions & 36 deletions src/Serializer/DenormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,9 @@ public function testItConvertsARecordsToAnObjectUsingProperties(): void
public function __construct(
#[MapCell(column:'temperature')]
public readonly float $temperature,
#[MapCell(column:2, cast: CastToEnum::class)]
#[MapCell(column:2)]
public readonly Place $place,
#[MapCell(
column: 'date',
cast: CastToDate::class,
options: ['format' => '!Y-m-d', 'timezone' => 'Africa/Kinshasa'],
)]
#[MapCell(column:'date', options: ['format' => '!Y-m-d', 'timezone' => 'Africa/Kinshasa'])]
public readonly DateTimeInterface $observedOn
) {
}
Expand All @@ -129,13 +125,9 @@ public function testItConvertsARecordsToAnObjectUsingMethods(): void
private float $temperature;

public function __construct(
#[MapCell(column:2, cast: CastToEnum::class)]
#[MapCell(column:2)]
public readonly Place $place,
#[MapCell(
column: 'date',
cast: CastToDate::class,
options: ['format' => '!Y-m-d', 'timezone' => 'Africa/Kinshasa'],
)]
#[MapCell(column: 'date', options: ['format' => '!Y-m-d', 'timezone' => 'Africa/Kinshasa'])]
private readonly DateTime $observedOn
) {
}
Expand Down Expand Up @@ -185,13 +177,9 @@ public function testItWillThrowIfTheHeaderIsMissingAndTheColumnOffsetIsAString()
private float $temperature;

public function __construct(
#[MapCell(column:2, cast: CastToEnum::class)]
#[MapCell(column:2)]
public readonly Place $place,
#[MapCell(
column: 'date',
cast: CastToDate::class,
options: ['format' => '!Y-m-d', 'timezone' => 'Africa/Kinshasa'],
)]
#[MapCell(column: 'date', options: ['format' => '!Y-m-d', 'timezone' => 'Africa/Kinshasa'])]
private readonly DateTime $observedOn
) {
}
Expand Down Expand Up @@ -230,13 +218,9 @@ public function testItWillThrowIfTheHeaderContainsInvalidOffsetName(): void
private float $temperature;

public function __construct(
#[MapCell(column:2, cast: CastToEnum::class)]
#[MapCell(column:2)]
public readonly Place $place,
#[MapCell(
column: 'date',
cast: CastToDate::class,
options: ['format' => '!Y-m-d', 'timezone' => 'Africa/Kinshasa'],
)]
#[MapCell(column: 'date', options: ['format' => '!Y-m-d', 'timezone' => 'Africa/Kinshasa'])]
private readonly DateTime $observedOn
) {
}
Expand Down Expand Up @@ -275,13 +259,9 @@ public function testItWillThrowIfTheColumnAttributesIsUsedMultipleTimeForTheSame
public function __construct(
#[MapCell(column:'temperature'), MapCell(column:'date')] /* @phpstan-ignore-line */
public readonly float $temperature,
#[MapCell(column:2, cast: CastToEnum::class)]
#[MapCell(column:2)]
public readonly Place $place,
#[MapCell(
column: 'date',
cast: CastToDate::class,
options: ['format' => '!Y-m-d', 'timezone' => 'Africa/Kinshasa'],
)]
#[MapCell(column: 'date', options: ['format' => '!Y-m-d', 'timezone' => 'Africa/Kinshasa'])]
public readonly DateTimeInterface $observedOn
) {
}
Expand All @@ -299,13 +279,9 @@ public function testItWillThrowIfTheColumnAttributesCasterIsInvalid(): void
public function __construct(
#[MapCell(column:'temperature', cast: stdClass::class)]
public readonly float $temperature,
#[MapCell(column:2, cast: CastToEnum::class)]
#[MapCell(column:2)]
public readonly Place $place,
#[MapCell(
column: 'date',
cast: CastToDate::class,
options: ['format' => '!Y-m-d', 'timezone' => 'Africa/Kinshasa'],
)]
#[MapCell(column: 'date', options: ['format' => '!Y-m-d', 'timezone' => 'Africa/Kinshasa'])]
public readonly DateTimeInterface $observedOn
) {
}
Expand Down

0 comments on commit 6dc3424

Please sign in to comment.