-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Add static test to detect blocks without name attribute #11092
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
Conversation
aad01fe
to
40de9fc
Compare
@magento-team This task wasn't added to list of static tests. How I can add it to travis? |
@ihor-sviziev Integrity tests are not executed on Travis environment:
Integrity tests are executed on the internal Bamboo environment. To run test locally you may use
|
@ihor-sviziev Are you interested in fixing new test failures? |
Well, last time I runned full static tests suite on Travis it finished quite quick. I propose to expand it by removing filter in scope of this PR. |
@vkublytskyi @orlangur will add running all static tests & fix new failures |
@vkublytskyi @orlangur I updated this PR, please review it again. PS: static tests are passed! |
@ihor-sviziev I don't know the exact reason why
|
@vkublytskyi let's keep AggregateInvoker for now. I just asked, maybe it was incorrect to use it. |
Could you please logically group changes into few commits and force push to the same branch?
It was introduced by me so I know the exact answer. Data providers created too much overhead, in some tests there were hundreds to thousands cases passed, for instance each layout XML in system. The biggest problem was Bamboo artifacts sizing as it tracks statistics for each test case separately. As there are no downsides, later it was used for a smaller data providers of only 10-20 cases as well. |
@orlangur grouped commits by module names. If it will be just two commits - it will be harder to review it . Isn't it? |
Not harder, I believe all added block names should be better in single commit (as those changes are similar, it's easy to review). One commit with enabling all static tests on Travis, one commit with test for block names, maybe there were some other changes also - like fixing some static tests besides introduced one. |
Run all static tests on Travis
Fix static test failures
@orlangur done. Please review |
@@ -12,7 +12,7 @@ | |||
</head> | |||
<body> | |||
<referenceContainer name="content"> | |||
<block class="Magento\Tax\Block\Adminhtml\Rule\Edit"/> | |||
<block class="Magento\Tax\Block\Adminhtml\Rule\Edit" name="content.tax_rule_edit"/> | |||
<block class="Magento\Tax\Block\Adminhtml\Rule\Edit\Form" name="tax-rule-edit" template="Magento_Tax::rule/edit.phtml"/> |
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.
A bit confusing but changing existing name would be a BC break, right?
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.
Not sure. As for me - this is not BC change because you hadn’t ability to customize these parts, now you will have. I don’t know any case what these changes could brake existing website
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.
Note the line I commented on - after change names are
name="content.tax_rule_edit"
and name="tax-rule-edit"
normally they should have been
name="tax-rule-edit"
and name="tax-rule-edit-form"
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.
@orlangur, @ihor-sviziev Changing a name of a block is A BiC so let's keep tax-rule-edit
even if it not consistent with other names.
@@ -0,0 +1,36 @@ | |||
<?php | |||
/** | |||
* Test block names exists |
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.
Copyright header should be static across all files and such comment should be placed in class PHPDoc.
Feel free to not change this now as there are a lot of such occurrences in code, it needs to be enforced and fixed once for all codebase.
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.
Could you fix them during merging this PR?
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.
I don't think it's worth neither mine nor your additional commit, just keep in mind for future contributions and I hope to contribute such PHPCS sniff to make all copyright headers and class comments consistent.
@ihor-sviziev great job 👍 Did you perform e57ef72 with bare hands or there was some kind of automation, like XSLT transformation? All internal builds passed except missing block names in EE modules. I expect @vkublytskyi will handle this. |
@orlangur I’ve done it manually. Hope it will be merged soon. |
@vkublytskyi @orlangur are these changes will be accepted? Can I prepare backport PRs for 2.2 and 2.1? |
@ihor-sviziev, Yes, this PR will be accepted. It may take more time than usually as we need to fix new test failures on Magento Commerce and B2B extensions. |
@vkublytskyi could you also process #11235 together, it will be more effective? |
…#11092 - fixed test failures
Description
This change covers an issue when block doesn't contain name attribute in layout file.
As was discussed in #10354 (comment) - need to covert missing block names issue with static test.
Fixed Issues (if relevant)
Related issues
Manual testing scenarios
Contribution checklist
For now I didn't fixed all places, but we can see list of them in failed test. Will create backport PRs to 2.2, 2.1 if it's needed