Skip to content

Conversation

@michelebenigniDoit
Copy link

No description provided.

@ilario-pierbattista ilario-pierbattista self-requested a review June 5, 2025 08:00
@ilario-pierbattista ilario-pierbattista marked this pull request as draft June 5, 2025 08:00

declare(strict_types=1);

namespace Tests\Unit;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test file path should be coherent with the path of StringDecoder

$decoder = new StringDecoder();
$context = new Context($decoder);

foreach ([123, 3.14, true] as $input) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but try to use PHPUnit's data providers


foreach ([123, 3.14, true] as $input) {
$result = $decoder->validate($input, $context);
$this->assertNotInstanceOf(ValidationSuccess::class, $result);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert on ValidationFailure instance instead

$context = new Context($decoder); //cosa controllare

//il valore da validare passa il controllo?
$result = $decoder->validate('ciao', $context);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use directly decode instead of validate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants