-
Notifications
You must be signed in to change notification settings - Fork 4
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
Unit tests for \OnMoon\OpenApiServerBundle\Controller\ApiController #158
base: master
Are you sure you want to change the base?
Conversation
@egorzot please improve coverage |
return new class implements SetRequest, RequestHandler { | ||
public function setRequest(Request $request): void | ||
{ | ||
throw new Exception('test request was set'); |
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.
This can be tested without exceptions, by creating a getter on this class and asserting that it returns the expected response object after the controller is executed.
return new class implements SetClientIp, RequestHandler { | ||
public function setClientIp(string $ip): void | ||
{ | ||
throw new Exception('test ip was set'); |
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.
This can be tested without exceptions, by creating a getter on this class and asserting that it returns the expected ip address after the controller is executed.
|
||
$this->expectException(Throwable::class); | ||
$this->expectException(Throwable::class); | ||
$this->expectExceptionMessage('"TestClass" has 0 public methods, exactly one expected'); |
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.
Maybe an anonymous class can be used here and get_class to assert it's name?
Closes #148