What are the Slack Archives?
Itโs a history of our time together in the Slack Community! Thereโs a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you wonโt be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hi all, question about tests - following error occurs: ``` Test ../Foo/Business/FooQueueTest.php:t
Hi all,
question about tests - following error occurs:
Test ../Foo/Business/FooQueueTest.php:testMessageSending [TypeError] Return value of Spryker\Zed\CompanyMailConnector\Business\CompanyMailConnectorBusinessFactory::getMailFacade() must implement interface Spryker\Zed\CompanyMailConnector\Dependency\Facade\CompanyMailConnectorToMailFacadeInterface, instance of Spryker\Zed\Customer\Dependency\Facade\CustomerToMailBridge returned #1 /builds/path/to-project/vendor/spryker/company-mail-connector/src/Spryker/Zed/CompanyMailConnector/Business/CompanyMailConnectorBusinessFactory.php:35 #2 /builds/path/to-project/vendor/spryker/company-mail-connector/src/Spryker/Zed/CompanyMailConnector/Business/CompanyMailConnectorBusinessFactory.php:25 #3 /builds/path/to-project/vendor/spryker/company-mail-connector/src/Spryker/Zed/CompanyMailConnector/Business/CompanyMailConnectorFacade.php:29 #4 /builds/path/to-project/vendor/spryker/company-mail-connector/src/Spryker/Zed/CompanyMailConnector/Communication/Plugin/Company/SendCompanyStatusChangePlugin.php:35 #5 /builds/path/to-project/vendor/spryker/company/src/Spryker/Zed/Company/Business/Model/CompanyPluginExecutor.php:66 #6 /builds/path/to-project/vendor/spryker/company/src/Spryker/Zed/Company/Business/Model/Company.php:135 #7 /builds/path/to-project/vendor/spryker/company/src/Spryker/Zed/Company/Business/Model/Company.php:74 #8 /builds/path/to-project/vendor/spryker/propel-orm/src/Spryker/Zed/PropelOrm/Business/Transaction/PropelDatabaseTransactionHandler.php:45 #9 /builds/path/to-project/vendor/spryker/company/src/Spryker/Zed/Company/Business/Model/Company.php:82 #10 /builds/path/to-project/vendor/spryker/company/src/Spryker/Zed/Company/Business/CompanyFacade.php:33 ERRORS!
we are only using default spryker helper in the tests and we also did nothing special within the code.. the test also worked for a while.. with adding another test, this error occurs ๐ค .. anybody an idea?
Comments
-
perhaps you should check if there are no updates for involved Spryker modules
0 -
we did not make any updates in the meantime.
0 -
yeah, but youโve probably started using a module which had a bug at the time it was installed
0 -
hmm okay, that could be ๐ค
0 -
Maybe some data cleanup is missing in your test?
0 -
IMHO it has nothing todo with data, because itโs PHP exception about interface mismatch
0 -
The problem is that the mail facade is provided in multiple module's dependency providers. The test setup is replacing that dependency globally in the dependency container (usually it is referred to as
FACADE_MAIL
). Since the different modules use different bridge interfaces, you see this issue coming up0 -
@UK5EG6PBM -> do you have any idea how this could be fixed? ๐ค
0 -
Well, you could change
MailFacadeInterface
on project level and have it inherit all the necessary bridge interfaces. If you mock the mail facade using your project level interface, all the other place should have satisfied dependencies0 -
Admittedly, that's not a pretty solution
0 -
Depending on the scope, it sometimes helps to limit replacement of dependencies during tests using the dependency helper and providing the necessary factory class name.
https://github.com/spryker/testify/blob/master/tests/SprykerTest/Shared/Testify/_support/Helper/DependencyHelper.php#L65The
$onlyFor
argument can be used to limit the scope of the replacement0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 77 Spryker News
- 938 Developer Corner
- 795 Spryker Development
- 90 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 27 Job Opportunities
- 3.2K ๐ Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 33 Product & Business Questions
- 69 Spryker Safari Questions
- 50 Random