testcontainers / testcontainers/testcontainers-php

Symfony Integration issue with TestConnectionFactory

Open
#22 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
215
Forks
34
Avg merge
1h 59m
Merged PRs (30d)
3

Description

I have updated packages to testcontainrs/testcontainers.

I followed the guide in the readme, created a TestConnectionFactory, and declared in the config/packages/test/services.yml.

But when running the tests, it can not find the host 127.0.0.1 and port 5432.

Check the test file: https://github.com/hantsy/symfony-rest-sample/blob/69e8c0d5f91ee999eb2b949bde6a6bf4a21876de/tests/Repository/PostRepositoryTestWithTestConnectionFactory.php

And services.yml file: https://github.com/hantsy/symfony-rest-sample/blob/69e8c0d5f91ee999eb2b949bde6a6bf4a21876de/config/packages/test/services.yml

And the TestConnnectionFactory file :https://github.com/hantsy/symfony-rest-sample/blob/69e8c0d5f91ee999eb2b949bde6a6bf4a21876de/tests/TestConnectionFactory.php

It seems the TestConnectonFactory is not applied at all.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/Repository/PostRepositoryTestWithTestConnectionFactory.php and tests/TestConnectionFactory.php, then inspect config/packages/test/services.yml to trace how the factory is registered for the test environment. Reproduce the failing test and verify that the configured factory is applied instead of attempting the default 127.0.0.1:5432 connection.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
backend, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.