Skip to content

add decodertest#139

Draft
michelebenigniDoit wants to merge 6 commits into
facile-it:masterfrom
michelebenigniDoit:2506_add_decodertest
Draft

add decodertest#139
michelebenigniDoit wants to merge 6 commits into
facile-it:masterfrom
michelebenigniDoit:2506_add_decodertest

Conversation

@michelebenigniDoit
Copy link
Copy Markdown

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
Comment thread tests/unit/StringDecoderTest.php Outdated

declare(strict_types=1);

namespace Tests\Unit;
Copy link
Copy Markdown
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

Comment thread tests/unit/StringDecoderTest.php Outdated
$decoder = new StringDecoder();
$context = new Context($decoder);

foreach ([123, 3.14, true] as $input) {
Copy link
Copy Markdown
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

Comment thread tests/unit/StringDecoderTest.php Outdated

foreach ([123, 3.14, true] as $input) {
$result = $decoder->validate($input, $context);
$this->assertNotInstanceOf(ValidationSuccess::class, $result);
Copy link
Copy Markdown
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

Comment thread tests/unit/StringDecoderTest.php Outdated
$context = new Context($decoder); //cosa controllare

//il valore da validare passa il controllo?
$result = $decoder->validate('ciao', $context);
Copy link
Copy Markdown
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.

3 participants