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..
```╭─/data | Store: US | Env: docker.dev | Debug: (X) | Testing: (X) ╰─$ codecept run -c tests/PyzTe
╭─/data | Store: US | Env: docker.dev | Debug: (X) | Testing: (X) ╰─$ codecept run -c tests/PyzTest/Zed/SomeModule/ Codeception PHP Testing Framework v4.1.1 Powered by PHPUnit 7.5.20 by Sebastian Bergmann and contributors. Running with seed: PyzTest\Zed\SomeModule.Business Tests (1) ----------------------------------------------------------------------- E DoingAThingMapperTest: Whatever ------------------------------------------------------------------------------------------------------------------------------------- In ConnectionFactory.php line 42: Unable to open connection In PdoAdapter.php line 72: Unable to open PDO connection In PdoConnection.php line 64: SQLSTATE[HY000] [2002] Connection refused ..... ╭─/data | Store: US | Env: docker.dev | Debug: (X) | Testing: (X)
/** * @var \PyzTest\Zed\Business\SomeModule */ public $tester; /** * @return void */ public function testWhatever() {
What’s up here?
Comments
-
Try enabling
\SprykerTest\Shared\Propel\Helper\ConnectionHelper
in your suite's codeception.yml0 -
suites: Business: path: Business class_name: SomeModule modules: enabled: - Asserts - \PyzTest\Shared\Testify\Helper\Environment - \SprykerTest\Zed\Testify\Helper\BusinessHelper: projectNamespaces: ['Pyz'] - \SprykerTest\Shared\Testify\Helper\DataCleanupHelper - \SprykerTest\Shared\Propel\Helper\TransactionHelper - \SprykerTest\Shared\Propel\Helper\ConnectionHelper
Nope
I did find that if I remove
suites: Business: path: Business class_name: SomeModule modules: enabled: - Asserts - \PyzTest\Shared\Testify\Helper\Environment - \SprykerTest\Zed\Testify\Helper\BusinessHelper: projectNamespaces: ['Pyz'] - \SprykerTest\Shared\Testify\Helper\DataCleanupHelper - \SprykerTest\Shared\Propel\Helper\TransactionHelper <- this line - \SprykerTest\Shared\Propel\Helper\ConnectionHelper
the error goes away, but then I assume I lose access to the DB
0 -
I just checked ... TransactionHelper already does the things that ConnectionHelper does so it's not necessary to have them both.
You could try with\SprykerTest\Shared\Propel\Helper\DatabaseHelper
which will configure the database connection. Perhaps that helps with using TransactionHelper0 -
Fatal error: Uncaught Error: Class 'Codeception\Module\Db' not found
0 -
composer require --dev codeception/module-db
0 -
huh ok… that seems unnecessary considering other tests have the Transaction helper enabled… I’ll give it a shot
0 -
But I don't think that's necessary to install. Weird ... perhaps it's simply the database configuration for your test environment that is wrong. Judging from the error message you posted it tried to establish a connection but fails. My first guess was that you're missing the required modules to provide database connectivity but that doesn't seem to be the issue
0 -
no worries thanks I’ll ask the spryker devs on my project, thought it was a more general thing since it died right outta the gate
0 -
So you're saying it works for some tests but not for others?
0 -
no I guess it doesn’t assuming it was working for the other tests, do I need to restart docker or something, did the test variable… did I miss a step
0 -
oh I’m and idiot I think you have to specify
0 -
nope that wasn’t it either… -t and testing seem to do the same thing…
0 -
The issue you have is a pretty common one. When running codeception with the
-c
option you are targeting a specific suite. When you simply use the-g
option (and don't use-c
) to target a test case all of the codeception.yml files will get loaded and all the modules they enable will get initialized. Usually one of the suites has the required modules enabled so your test case runs just fine.
When you use-c
on the other hand, only the modules for that particular suite are initialized and it's pretty common that it is missing to enable a couple of required modules.0 -
ah
0 -
which logically means that one of the tests suites has the answer in enabled
0 -
Since that has happened to me as well in the past, my usual solution is to check if I have all the required database modules enabled, hence my first suggestion
0 -
Yes, the answer should be in one of the other codeception.yml files
0 -
Try running your test without the
-c
option. If that works you're on the right path0 -
yup ok
[PyzTest\Zed\SomeModule]: tests from /data/tests/PyzTest/Zed/SomeModule PyzTest\Zed\SomeModule.Business Tests (1) ----------------------------------------------------------------------- ✔ TestsAThingTest: That inactive items are not on clearance (0.00s) -----------------------------------------------------------------------------------------------------
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