Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Fix Fatal error on invalid input #97

Merged
merged 1 commit into from
May 15, 2017

Conversation

cirnatdan
Copy link

Issue

Request with invalid schema are sent to the hydrator which results in Fatal errors

Expected

RequestProcessor should throw a ValidationException before invoking the hydrator.
The client should receive a 400 response

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 99.608% when pulling 413e1a3 on cirnatdan:fix-input-validation into 2438d72 on kleijnweb:master.

@kleijnweb
Copy link
Owner

Thanks for reporting this bug. To fix your test, just change it to:

/**
 * @test
 */
public function willThrowExceptionIfRequestBodyIsNotValid()
{
    $this->hydratorMock->expects($this->never())
        ->method('hydrate');

    $processor = $this->createProcessor(true, false);
    $this->expectException(ValidationException::class);

    $processor->process(
        $this->createRequest(
            [
                RequestMeta::ATTRIBUTE_URI  => '/uri',
                RequestMeta::ATTRIBUTE_PATH => '/path',
            ],
            json_encode([])
        )
    );
}

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.606% when pulling bbbd32f on cirnatdan:fix-input-validation into 3a2d0d9 on kleijnweb:master.

@kleijnweb kleijnweb merged commit e603019 into kleijnweb:master May 15, 2017
@cirnatdan
Copy link
Author

cirnatdan commented May 15, 2017 via email

@cirnatdan cirnatdan deleted the fix-input-validation branch May 15, 2017 21:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants