-
Notifications
You must be signed in to change notification settings - Fork 3
add decodertest #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
add decodertest #139
Conversation
tests/unit/StringDecoderTest.php
Outdated
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Unit; |
There was a problem hiding this comment.
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
tests/unit/StringDecoderTest.php
Outdated
$decoder = new StringDecoder(); | ||
$context = new Context($decoder); | ||
|
||
foreach ([123, 3.14, true] as $input) { |
There was a problem hiding this comment.
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
tests/unit/StringDecoderTest.php
Outdated
|
||
foreach ([123, 3.14, true] as $input) { | ||
$result = $decoder->validate($input, $context); | ||
$this->assertNotInstanceOf(ValidationSuccess::class, $result); |
There was a problem hiding this comment.
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
tests/unit/StringDecoderTest.php
Outdated
$context = new Context($decoder); //cosa controllare | ||
|
||
//il valore da validare passa il controllo? | ||
$result = $decoder->validate('ciao', $context); |
There was a problem hiding this comment.
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
No description provided.