-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fix failing intergration test (RAD-1066) #72
Conversation
|
||
/** | ||
* @covers \Lmc\Matej\RequestBuilder\EventsRequestBuilder | ||
*/ | ||
class EventsRequestBuilderTest extends IntegrationTestCase | ||
{ | ||
protected function setup(): void |
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 should be setUp, and I'm wondering why this was not detected by codestyle check, there should be one exactly for this 🤔
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.
{ | ||
$builder = $this->createMatejInstance()->request()->setupItemProperties(); | ||
|
||
$this->buildAndSendPropertySetupRequest($builder); |
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.
Is it OK this will be done before each test method in this testcase?
|
||
private function buildAndSendPropertySetupRequest(ItemPropertiesSetupRequestBuilder $builder): void | ||
{ | ||
$builder->addProperty(ItemPropertySetup::string('test_property_a')) |
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.
We may add the identifier to some private class constants, to signalize these are "predefined" item properties available for use in this test. What do you thing?
|
||
/** | ||
* @covers \Lmc\Matej\RequestBuilder\EventsRequestBuilder | ||
*/ | ||
class EventsRequestBuilderTest extends IntegrationTestCase | ||
{ | ||
protected function setup(): void |
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.
@@ -32,21 +32,21 @@ protected function createMatejInstance(): Matej | |||
return $instance; | |||
} | |||
|
|||
protected function assertResponseCommandStatuses(Response $response, ...$expectedCommandStatuses): void | |||
protected static function assertResponseCommandStatuses(Response $response, ...$expectedCommandStatuses): void |
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.
Why is this static? This should be non-static, co it could be used in a same way as other phpunit asserts (via $this->assertResponseCommandStatuses, not static::assertResponseCommandStatuses)
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.
} | ||
} | ||
|
||
protected function createMatejInstance(): Matej | ||
protected static function createMatejInstance(): Matej |
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.
If you declare the method static, you should use it via static call eveywhere where it is being used (in all other testcases)... Like static::createMatejInstance()
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.
👍 fixed, thanks :)
@@ -32,21 +32,21 @@ protected function createMatejInstance(): Matej | |||
return $instance; | |||
} | |||
|
|||
protected function assertResponseCommandStatuses(Response $response, ...$expectedCommandStatuses): void | |||
protected static function assertResponseCommandStatuses(Response $response, ...$expectedCommandStatuses): void |
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.
cf93778
to
020b94d
Compare
Nice job @foglcz, thanks! 👍 |
Fixes failing integration test, which was failing because of uninitialized item properties.