forked from magento/magento-coding-standard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9185a9f
commit 80bfe89
Showing
5 changed files
with
21 additions
and
8 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
Magento2/Sniffs/Namespaces/ImportsFromTestNamespaceSniff.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Rule: Do not import from `Test` namespaces | ||
## Background | ||
Sometimes IDE imports the namespace with `Test` automatically for return data type like string, float etc or any other means. | ||
|
||
## Reasoning | ||
Time to time we're getting issue with running tests on PRs in magento/magento2 repository because someone imported `\Magento\Tests\NamingConvention\true\string` by mistake. As result - we have "No build reports available" for "Database Compare build", "Functional Tests build", "Sample Data Tests build" while Static tests are shown as "failing" but in results - we don't really have reason | ||
|
||
## How it works | ||
Any occurrence starts with `Magento\Tests` in import from the namespace will raise the warning. | ||
|
||
## How to fix | ||
|
||
Remove `Magento\Tests` from the imported namespaces |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...sts/Namespaces/UseDeclarationUnitTest.inc → ...aces/ImportsFromTestNamespaceUnitTest.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
use Magento\Tests; | ||
use Magento\Foo\Tests as FakeTest; | ||
use Magento\Real\Classes; | ||
use Magento\Real\Classes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters