-
Notifications
You must be signed in to change notification settings - Fork 133
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
MFTF-33782: Added empty query and fragment testing to the UrlFormatterTest #867
MFTF-33782: Added empty query and fragment testing to the UrlFormatterTest #867
Conversation
@bohdan-harniuk |
@jilu1, could you please proceed with the code review? I had to change few places to make everything in the right way. Thanks, Bohdan |
@magento import pull request to https://github.com/magento-commerce/magento2-functional-testing-framework |
@jilu1 the pull request successfully imported. |
return [ | ||
[$path1, null, $path1], | ||
[$path1, false, $path1], |
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.
@bohdan-harniuk
I see you have changed null
to false
in many places for data input. Isn't it the opposite of the original test. Am I missing something here?
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.
Hello, @jilu1!
I've done it after the small investigation. I believe that bool variables should have only two states: TRUE or FALSE.
There are 55 places, in the MFTF source code, where FilePathFormatter::format
method is called.
Also, there are 17 places in the MFTF source code where UrlFormatter::format
method is called.
I've checked all those places, if in any of them there is null value passed into those methods. There is no such place.
So, I decided to limit the value of this variable: TRUE or FALSE.
The NULL values was passed only during testing for both cases.
Do we have some other intentions to allow pass here NULL value (?bool instead of bool)?
Thanks, Bohdan
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.
@bohdan-harniuk
Maybe we can use ?bool
here. The intention is when NULL
is used, the relevant parameter is omitted and thus to test using the default value in FilePathFormatter::format
or UrlFormatter::format
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.
@jilu1
It makes sense! I'll rollback NULL values.
Thank you!
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.
Please see my comment and clarify. Thanks!
860a39e
Hello, @jilu1! I've made required modifications. Now, NULL value is equal to the default argument value. Please, pay attention, I had to change expected values for the datasets with the NULL value for trailing separator boolean argument. It is done because previously we didn't check default value but the opposite -> NULL was interpreted as FALSE. Thanks, Bohdan |
Description
I've investigated the impact of the new changes in parse_url() function for PHP 8 on the current MFTF codebase.
Reported change (from the official documentation):
parse_url() will now distinguish absent and empty queries and fragments:
Previously all cases resulted in query and fragment being null.
In the MFTF codebase this function used only in the
\Magento\FunctionalTestingFramework\Util\Path\UrlFormatter
class.I've added two data sets to the
\tests\unit\Magento\FunctionalTestFramework\Util\Path\UrlFormatterTest::formatDataProvider
to cover cases when parsed URL has an empty query, an empty fragment or both of them.The result of testing for the PHP7.3:
The result of testing for the PHP8.0:
During this investigation I've found that the
\Magento\FunctionalTestingFramework\Util\Path\UrlFormatter
class is not strictly typed and has errors regarding strict typing:Investigation summary
I propose to extend the
UrlFormatterTest
with the new data sets. If the core team of the MFTF framework will consider those new datasets useful. If not, anyway, this also could be closed and taken into account only the result of this investigation regarding the related issue.Also, I propose to make the
UrlFormatter
class strictly typed and fix strict type issues in the scope of this PR.Related Issues
Contribution checklist