symfony / test-pack

A Symfony Pack for functional testing
MIT License
858 stars 9 forks source link

Add TestContainers Support #20

Open hantsy opened 1 month ago

hantsy commented 1 month ago

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).

ciaranmcnulty commented 1 month ago

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?

hantsy commented 1 month ago

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.