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..
Hey! I am trying to use `$this->tester->getLocator()->product()->facade()` in a codecept
Hey!
I am trying to use $this->tester->getLocator()->product()->facade()
in a codeception unit test.
This leads to an exception about missing factory.
[Spryker\Zed\Kernel\ClassResolver\Factory\FactoryNotFoundException] Spryker Kernel Exception Can not resolve ProductBusinessFactory in Business layer for your module "Product" You can fix this by adding the missing Factory to your module. E.g. Pyz\Zed\Product\Business\ProductBusinessFactory
In my codeception.yml the following modules are enabled:
- Asserts - \PyzTest\Shared\Testify\Helper\Environment - \SprykerTest\Shared\Testify\Helper\LocatorHelper: projectNamespaces: ['Pyz'] - \SprykerTest\Shared\Testify\Helper\DependencyHelper - \SprykerTest\Shared\Testify\Helper\DataCleanupHelper - \SprykerTest\Shared\Propel\Helper\TransactionHelper
In fact the factory exists, even on project level, and, of course, on vendor level.
Any ideas whats going wrong?
Comments
-
This is usually a typo in the Factory's name. The error is pretty common though
0 -
Does it extend AbstractFactory?
0 -
The name of the project level factory is
Pyz\Zed\Product\Business\ProductBusinessFactory
. It extendsSpryker\Zed\Product\Business\ProductBusinessFactory
on project level and this one extendsAbstractBusinessFactory
0 -
Check namespace, maybe problem there
0 -
Of folder naming
0 -
Is it possible that this is a bug?
I am asking because https://github.com/spryker/kernel/blob/master/src/Spryker/Zed/Kernel/ClassResolver/Factory/FactoryResolver.php#L21 =>protected const RESOLVABLE_TYPE = 'ZedFactory';
But in https://github.com/spryker/kernel/blob/master/src/Spryker/Shared/Kernel/ClassResolver/AbstractClassResolver.php#L240
$this->getResolvableTypeClassNamePatternMap()
returns an array as visible in attached screenshot.There is no key
ZedFactory
soclassNamePattern
is null and factory can not be resolved...If i change it to
protected const RESOLVABLE_TYPE = 'ZedFactoryBusiness';
it works as expected.0 -
I am on kernel 3.55, which is the latest version.
0 -
\Spryker\Zed\Kernel\ClassResolver\Business\BusinessFactoryResolver::RESOLVABLE_TYPE
0 -
Yes, but this class seems not to be used...
/data/vendor/spryker/kernel/src/Spryker/Zed/Kernel/ClassResolver/Factory/FactoryNotFoundException.php:49 /data/vendor/spryker/kernel/src/Spryker/Zed/Kernel/ClassResolver/Factory/FactoryNotFoundException.php:23 /data/vendor/spryker/kernel/src/Spryker/Zed/Kernel/ClassResolver/Factory/FactoryResolver.php:38 /data/vendor/spryker/testify/src/Spryker/Zed/Testify/Locator/Business/BundleProxy.php:110 /data/vendor/spryker/testify/src/Spryker/Zed/Testify/Locator/Business/BundleProxy.php:67 /data/vendor/spryker/testify/src/Spryker/Zed/Testify/Locator/Business/BundleProxy.php:52
0 -
Ah may be its a wrong spryker/testify version
0 -
yeah
0 -
that seems to be the problem. i am on 3.20.
I will update and give feedback here. thanks a lot up to here0 -
Yep, that helps... Thanks for your input! π
0 -
Good to hear!
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 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
- 26 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
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random