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

[Issue] Cleanup of some non-existing classes from some unit tests code in the… #37636

Closed
2 of 5 tasks
m2-assistant bot opened this issue Jun 19, 2023 · 2 comments · Fixed by #37629
Closed
2 of 5 tasks

[Issue] Cleanup of some non-existing classes from some unit tests code in the… #37636

m2-assistant bot opened this issue Jun 19, 2023 · 2 comments · Fixed by #37629
Assignees
Labels
Area: Test framework Component: TestFramework Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@m2-assistant
Copy link

m2-assistant bot commented Jun 19, 2023

This issue is automatically created based on existing pull request: #37629: Cleanup of some non-existing classes from some unit tests code in the…


… Magento framework.

Description (*)

In an attempt at slowly fixing phpstan reported issues in the entire Magento codebase, I took a look today at the Framework code and searched for classes used that don't exist (any more). I've only found some fixes for some unit tests in the Framework code. This fixes 7 errors out of 173 phpstan errors found in total when scanning on level 0 on the Framework code.

Errors fixed:

 ------ ---------------------------------------------------------------------------- 
  Line   internal/Magento/Framework/Filesystem/Test/Unit/File/ExcludeFilterTest.php  
 ------ ---------------------------------------------------------------------------- 
  55     Class SplFileInfoClass not found.                                           
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols         
 ------ ---------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------- 
  Line   internal/Magento/Framework/ObjectManager/Test/Unit/Factory/CompiledTest.php  
 ------ ----------------------------------------------------------------------------- 
  302    Class Magento\Framework\ObjectManager\Test\Unit not found.                   
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols          
  308    Class Magento\Framework\ObjectManager not found.                             
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols          
 ------ ----------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   internal/Magento/Framework/ObjectManager/Test/Unit/Helper/SortItemsTest.php                                                                                                                      
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  18     Property Magento\Framework\ObjectManager\Test\Unit\Helper\SortItemsTest::$_itemInterpreter has unknown class Magento\Framework\ObjectManager\Test\Unit\Helper\InterpreterInterface as its type.  
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                                                                                                                              
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

------ ---------------------------------------------------------------------- 
  Line   internal/Magento/Framework/Pricing/Test/Unit/Render/PriceBoxTest.php  
 ------ ---------------------------------------------------------------------- 
  77     Class Magento\Store\Model\Store\Config not found.                     
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols   
 ------ ---------------------------------------------------------------------- 

------ ------------------------------------------------------------------------ 
  Line   internal/Magento/Framework/TestFramework/Unit/Helper/ObjectManager.php  
 ------ ------------------------------------------------------------------------ 
  163    Class Magento\Framework\Api\Builder not found.                          
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols     
 ------ ------------------------------------------------------------------------ 

------ -------------------------------------------------------------------------------------- 
  Line   internal/Magento/Framework/Webapi/Test/Unit/Rest/Request/DeserializerFactoryTest.php  
 ------ -------------------------------------------------------------------------------------- 
  65     Class Magento\Framework\Webapi\Response\Rest\Renderer\Json not found.                 
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                   
 ------ -------------------------------------------------------------------------------------- 

Related Pull Requests

None

Fixed Issues (if relevant)

None

Manual testing scenarios (*)

  1. Run: vendor/bin/phpstan clear-result-cache && bin/magento setup:di:compile && composer dump-autoload
  2. Run: vendor/bin/phpstan analyse --level=0 lib/
  3. After applying the changes from this PR and re-running steps 1 and 2 from above, you should have 7 fewer errors.
  4. Also check if after these changes, all unit tests keep running correctly (but the automated tests on github should take care of testing this).

Questions or comments

It is my hope that it's Adobe's goal one day to have zero issues that phpstan finds on level 0, since those are the most important ones to fix usually. If we finally have level 0 tackled across the entire codebase, we can slowly go up one by one which would also allow the checks in pull requests here to be made against a higher level than only 0, which in the end should hopefully result in a lot more stable code then what we have right now.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)
@m2-assistant m2-assistant bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Jun 19, 2023
@m2-community-project m2-community-project bot added this to Pull Request In Progress in High Priority Backlog Jun 19, 2023
@engcom-Lima engcom-Lima added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Component: TestFramework Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Reported on 2.4.x Indicates original Magento version for the Issue report. Area: Test framework labels Jun 20, 2023
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-9035 is successfully created for this GitHub issue.

@m2-assistant
Copy link
Author

m2-assistant bot commented Jun 20, 2023

✅ Confirmed by @engcom-Lima. Thank you for verifying the issue.
Issue Available: @engcom-Lima, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Test framework Component: TestFramework Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Development

Successfully merging a pull request may close this issue.

3 participants