How are the tests in vendor modules executed ?
I have some custom modules that I have created and I would like to use them throughout projects, by making them as composer packages.
I was wondering how to bundle the tests inside the composer package. For inspiration I took a look at how the Spryker vendor modules structure the tests. I used the same structure and I can make simple assertion tests work, but if I want to use database for example, by incudling TransactionHelper
, then when I run the tests, I get an error:
Could not find config key "PROJECT_NAMESPACES" in "Spryker\Shared\Config\Config"
Curiously, when I try to run the tests in Spryker vendor modules, I get the same error.
I use the usual algorithm for testing:
codecept build
codecept run -c path-to-suite
I see for example that in Availability module there are tests that use product helpers to get a product:
And the codeception.yml
files do not have anything out of the ordinary, besides the fact that LocatorHelper
has no projectNamespaces
defined.
So can anyone explain how the vendor module tests are executed ?
Answers
-
This is troubling me as well. Does anyone know ?
I also have issue with chromedriver. It just doesn't recognize it. And Tests for communication break with error.
"[Spryker\Service\Container\Exception\NotFoundException] The requested service "kernel" was not found in the container!"0 -
Furthermore
Using
- \SprykerTest\Zed\Router\Helper\RouterHelper
from
vendor/spryker/router/tests/SprykerTest/Zed/Router/_support/Helper/RouterHelper.php
Always producest error
[Symfony\Component\Finder\Exception\DirectoryNotFoundException] The "/data/vendor/spryker/Bundles//src/Spryker/Zed//Communication/Controller/" directory does not exist.
$controllerDirectories = sprintf('%s/spryker/spryker/Bundles//src/Spryker/Zed//Communication/Controller/', APPLICATION_VENDOR_DIR);
APPLICATION_VENDOR_DIR = /data/vendor$controllerDirectories path isn't valid path.
I removed "spryker/Bundles/"$controllerDirectories = sprintf('%s/spryker/Bundles//src/Spryker/Zed//Communication/Controller/', APPLICATION_VENDOR_DIR);
With that change i don't have error any more.
0 -
For issue in my previous comment. Solution is to add this in config_default.
$config[RouterConstants::ZED_CACHE_PATH] = sprintf( '%s/src/Generated/Router/Backoffice/codeBucket%s/', APPLICATION_ROOT_DIR, APPLICATION_CODE_BUCKET, );
Errror happens because when we trigger test from console it compares routes with depricated methods. Placing up above code snippet forces the depricated moethod to have same path as non depricated method.
@JungleBoy I found the solution for triggering vendor tests.
In file codeception.yml in root of the project add path to configuration file of that test under the "include" seciton.
For example I want to trigger tests in "Discounts" module.namespace: PyzTest actor: Tester include: - tests/PyzTest/*/* - vendor/spryker/discount/tests/SprykerTest/*/* paths: tests: tests output: tests/_output data: tests/_data support: tests/_support envs: tests/_envs
Hope it helps.
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 75 Spryker News
- 920 Developer Corner
- 780 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 25 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