test-pack icon indicating copy to clipboard operation
test-pack copied to clipboard

Add TestContainers Support

Open hantsy opened this issue 1 year ago • 2 comments
trafficstars

Nowdays Testcontainers is very popular for writing integration test for database, etc. on local machines.

TestContainers officially support a collection of programming languages, but lacks PHP support.

Check here: https://testcontainers.com/getting-started/

There is a PHP implementation from the community, https://github.com/shyim/testcontainer

Hope there is official bundle to integrate Testscontainers(running Docker on local machine) and Testcontainers cloud APIs(running Docker containers remotely).

hantsy avatar Jun 07 '24 05:06 hantsy

There are a few attempts at porting TestContainers to PHP but none are done or 'official' yet.

I'm unclear what Symfony-specific support would look like?

ciaranmcnulty avatar Jun 07 '24 12:06 ciaranmcnulty

I have tried to shyim/testcontainer in my Symfony sample project, https://github.com/hantsy/symfony-rest-sample/pull/387/files, and just used the PostgresContainer, it lacks a lot of features that provided in TestContainers Java implementation.

For example, the following features I used frequently in testconainters Java.

  1. print pull and starting log.
  2. Random ports exposed.
  3. copy init.sql to docker container etc.

hantsy avatar Jun 09 '24 02:06 hantsy

Dagger looks nice on the topic. See https://github.com/symfony/symfony/pull/59240 for some efforts to use it for Symfony itself. Let me close as this repo is not the one where this should be discussed (nobody tracks this repo)

nicolas-grekas avatar May 20 '25 14:05 nicolas-grekas