Skip to content
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

Merged
merged 1 commit into from
Apr 17, 2018
Merged

Conversation

foglcz
Copy link
Contributor

@foglcz foglcz commented Apr 13, 2018

Type Bugfix
Fixes issues n/a
Documentation n/a
BC Break no
Tests updated yes

Fixes failing integration test, which was failing because of uninitialized item properties.


/**
* @covers \Lmc\Matej\RequestBuilder\EventsRequestBuilder
*/
class EventsRequestBuilderTest extends IntegrationTestCase
{
protected function setup(): void
Copy link
Member

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 🤔

Copy link
Member

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);
Copy link
Member

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'))
Copy link
Member

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?

@OndraM OndraM removed the request for review from michalrychlik April 13, 2018 13:28

/**
* @covers \Lmc\Matej\RequestBuilder\EventsRequestBuilder
*/
class EventsRequestBuilderTest extends IntegrationTestCase
{
protected function setup(): void
Copy link
Member

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
Copy link
Member

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)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what happens then:
static

So if we don't need to, lets keep this non-static :)

}
}

protected function createMatejInstance(): Matej
protected static function createMatejInstance(): Matej
Copy link
Member

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()

Copy link
Contributor Author

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what happens then:
static

So if we don't need to, lets keep this non-static :)

@foglcz foglcz force-pushed the bugfix/integration-tests branch from cf93778 to 020b94d Compare April 17, 2018 13:14
@OndraM OndraM merged commit 66a3e1a into master Apr 17, 2018
@OndraM
Copy link
Member

OndraM commented Apr 17, 2018

Nice job @foglcz, thanks! 👍

@OndraM OndraM deleted the bugfix/integration-tests branch April 17, 2018 13:32
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.

2 participants