testcontainers / testcontainers/testcontainers-php

Add abstrction to Rdbms Container

Open
#25 0 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

In the Java implementation, there is a JdbcDatabaseContainer abstract class(it should be an interface from the design view) and an R2dbcDatabaseContainer interface to unite the common properties when connecting Rdbms with JDBC or R2dbc driver.

In this PHP implementation, common properties such as databaseName, username, password, etc., are varied in different database containers.

For example, MySQL:

$container->withMariaDBDatabase('foo');
$container->withMariaDBUser('bar', 'baz');

and Postgres:

->withPostgresUser('test')
->withPostgresDatabase('foo')

These properties' naming looks a little tedious, we know the database type when creating the container, so why add database type as the prefix of these properties?

It is better to use some interface to unite these properties for Rdbms.

  • DatabaseName
  • Username
  • Password
  • TestQueryString
interface RdbmsContainer{ 
}

Or PdoDatabaseContainer and DoctrineDatabaseContainer to add driver-specific properties, as described in #23.

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

No PHP file or test is named. Start by locating the MySQL and Postgres container APIs and compare the listed common properties—databaseName, username, password, and testQueryString—before choosing between RdbmsContainer and driver-specific interfaces. Done means the agreed interface is applied consistently without database-specific prefixes; the issue does not define tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
databases
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.