-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Description
Preconditions
- Magento 2.3.4
- PHP 7.2
bitexpert/phpstan-magento
0.1.0
Steps to reproduce
-
Create an example integration test in your module, e.g.
\Company\Module\Test\Integration\ExampleTest
:<?php declare(strict_types=1); namespace Company\Module\Test\Integration; use Magento\TestFramework\Helper\Bootstrap; use PHPUnit\Framework\TestCase; class ExampleTest extends TestCase { protected function setUp(): void { Bootstrap::getObjectManager(); } }
-
Run
vendor/bin/phpstan analyze --level=8 src/Company/Module/Test/Integration
.
Expected result
- No issues are found.
Actual result
-
One issue is found:
Call to static method getObjectManager() on an unknown class Magento\TestFramework\Helper\Bootstrap
Workaround
Ignore the error in your phpstan.neon
:
ignoreErrors:
- '#Call to static method getObjectManager\(\) on an unknown class Magento\\TestFramework\\Helper\\Bootstrap.#'
The same issue occurs when you try to use the alternative \Magento\Framework\App\ObjectManager::getInstance
, so this can unfortunately not be used as a workaround.
Idea
Do we need to add another custom autoloader for Magento\TestFramework
?
Metadata
Metadata
Assignees
Labels
No labels