-
Notifications
You must be signed in to change notification settings - Fork 94
Followup of Symfony TestContainer issue #212
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
Please fix the build failures. |
Done! |
@Pierstoval This works perfectly for me too 👍 ! |
Thank you! Gonna release it immediately. |
This seems to end in a strange error now when using a trait expecting a I'm now getting: ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Line src/Sulu/Bundle/TestBundle/Testing/ContainerTrait.php (in context of class Sulu\Bundle\TestBundle\Testing\KernelTestCase)
------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
32 Method Sulu\Bundle\TestBundle\Testing\KernelTestCase::getContainer() should return Symfony\Bundle\FrameworkBundle\Test\TestContainer but returns Symfony\Component\DependencyInjection\ContainerInterface.
------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ I'm not understanding why here I think the Problem is that phpstan is not knowing that |
/** | ||
* @return TestContainer | ||
*/ | ||
abstract public function getContainer(); |
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.
Also think this should be protected static
like the implemntation: https://github.com/symfony/symfony/blob/94533d419fb54aac8c9391fa9cbe03342ee8f374/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php#L88
I'm meeting the same issue as @alexander-schranz, why |
Indeed there's no real guarantee based on types, but in practice, it's always the case when using the full-stack framework: https://github.com/symfony/symfony/blob/60ce5a3dfbd90fad60cd39fcb3d7bf7888a48659/src/Symfony/Bundle/FrameworkBundle/Resources/config/test.php#L48 |
Think The Maybe a more general solution to provide access to test container xml and dev container xml and based what files are analyzed the correct services are returned so also other services which are available only in test environment work like expected: container_xml_path: var/cache/dev/srcDevDebugProjectContainer.xml
test_container_xml_path: var/cache/test/srcTestDebugProjectContainer.xml
test_file_regex: 'Test.php$' Or we can manipulate the loading of |
About the XML part, I'm not sure about what you'd like to achieve. I personally specify the Test container in my |
Followup of #27 and #210