mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-08 15:29:31 +00:00
Merge pull request #14 from testcontainers/rename
feat: rename package name
This commit is contained in:
+44
-11
@@ -2,21 +2,60 @@ name: PHP
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
cs:
|
||||
runs-on: ubuntu-latest
|
||||
name: Code Style
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP with PECL extension
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress
|
||||
|
||||
- name: Run cs
|
||||
run: composer run cs
|
||||
|
||||
phpstan:
|
||||
runs-on: ubuntu-latest
|
||||
name: Static Analysis
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress
|
||||
|
||||
- name: Run phpstan
|
||||
run: composer run phpstan
|
||||
|
||||
phpunit:
|
||||
runs-on: ubuntu-latest
|
||||
name: Integration Tests
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
@@ -27,9 +66,3 @@ jobs:
|
||||
|
||||
- name: Run test suite
|
||||
run: composer run integration
|
||||
|
||||
- name: Run cs
|
||||
run: composer run cs
|
||||
|
||||
- name: Run phpstan
|
||||
run: composer run phpstan
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
/vendor/
|
||||
.php-cs-fixer.cache
|
||||
/.php-cs-fixer.cache
|
||||
/.phpunit.cache
|
||||
/composer.lock
|
||||
@@ -2,14 +2,12 @@
|
||||
|
||||
Testcontainers is a PHP package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The package is inspired by the [Testcontainers](https://www.testcontainers.org/) project for Java.
|
||||
|
||||
[@sironheart](https://github.com/sironheart) has annoyed me to test testcontainers, but it didn't existed in PHP yet.
|
||||
|
||||
## Installation
|
||||
|
||||
Add this to your project with composer
|
||||
|
||||
```bash
|
||||
composer req --dev shyim/testcontainer
|
||||
composer req --dev testcontainers/testcontainers
|
||||
```
|
||||
|
||||
## Usage/Examples
|
||||
@@ -19,7 +17,7 @@ composer req --dev shyim/testcontainer
|
||||
```php
|
||||
<?php
|
||||
|
||||
use Testcontainer\Container\MySQLContainer;
|
||||
use Testcontainers\Container\Container;
|
||||
|
||||
$container = Container::make('nginx:alpine');
|
||||
|
||||
@@ -60,7 +58,7 @@ $container->withWait(new WaitForHealthCheck());
|
||||
```php
|
||||
<?php
|
||||
|
||||
use Testcontainer\Container\MySQLContainer;
|
||||
use Testcontainers\Container\MySQLContainer;
|
||||
|
||||
$container = MySQLContainer::make('8.0');
|
||||
$container->withMySQLDatabase('foo');
|
||||
@@ -82,7 +80,7 @@ $pdo = new \PDO(
|
||||
```php
|
||||
<?php
|
||||
|
||||
use Testcontainer\Container\MariaDBContainer;
|
||||
use Testcontainers\Container\MariaDBContainer;
|
||||
|
||||
$container = MariaDBContainer::make('8.0');
|
||||
$container->withMariaDBDatabase('foo');
|
||||
@@ -104,7 +102,7 @@ $pdo = new \PDO(
|
||||
```php
|
||||
<?php
|
||||
|
||||
use Testcontainer\Container\PostgresContainer;
|
||||
use Testcontainers\Container\PostgresContainer;
|
||||
|
||||
$container = PostgresContainer::make('15.0', 'password');
|
||||
$container->withPostgresDatabase('database');
|
||||
@@ -125,7 +123,7 @@ $pdo = new \PDO(
|
||||
|
||||
```php
|
||||
|
||||
use Testcontainer\Container\RedisContainer;
|
||||
use Testcontainers\Container\RedisContainer;
|
||||
|
||||
$container = RedisContainer::make('6.0');
|
||||
|
||||
@@ -141,7 +139,7 @@ $redis->connect($container->getAddress());
|
||||
|
||||
```php
|
||||
|
||||
use Testcontainer\Container\OpenSearchContainer;
|
||||
use Testcontainers\Container\OpenSearchContainer;
|
||||
|
||||
$container = OpenSearchContainer::make('2');
|
||||
$container->disableSecurityPlugin();
|
||||
@@ -168,7 +166,7 @@ use Doctrine\Bundle\DoctrineBundle\ConnectionFactory;
|
||||
use Doctrine\Common\EventManager;
|
||||
use Doctrine\DBAL\Configuration;
|
||||
use Doctrine\DBAL\Tools\DsnParser;
|
||||
use Testcontainer\Container\PostgresContainer;
|
||||
use Testcontainers\Container\PostgresContainer;
|
||||
|
||||
class TestConnectionFactory extends ConnectionFactory
|
||||
{
|
||||
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "shyim/testcontainer",
|
||||
"description": "Testcontainer implementation in PHP",
|
||||
"name": "testcontainers/testcontainers",
|
||||
"description": "Testcontainers implementation in PHP",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"docker",
|
||||
"testcontainer"
|
||||
"testcontainers"
|
||||
],
|
||||
"type": "library",
|
||||
"authors": [
|
||||
@@ -15,7 +15,7 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">= 8.1",
|
||||
"symfony/process": "^5.3|^6.0|^7.0"
|
||||
"symfony/process": "^5.0|^6.0|^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.5",
|
||||
@@ -28,12 +28,12 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Testcontainer\\": "src/"
|
||||
"Testcontainers\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Testcontainer\\Tests\\": "tests/"
|
||||
"Testcontainers\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
cacheResultFile=".phpunit.cache/test-results"
|
||||
executionOrder="depends,defects"
|
||||
beStrictAboutCoversAnnotation="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
beStrictAboutTodoAnnotatedTests="true"
|
||||
convertDeprecationsToExceptions="true"
|
||||
failOnRisky="true"
|
||||
failOnWarning="true"
|
||||
verbose="true">
|
||||
<testsuites>
|
||||
<testsuite name="default">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<coverage cacheDirectory=".phpunit.cache/code-coverage"
|
||||
processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">src</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
</phpunit>
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Container;
|
||||
namespace Testcontainers\Container;
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
use Testcontainer\Exception\ContainerNotReadyException;
|
||||
use Testcontainer\Registry;
|
||||
use Testcontainer\Trait\DockerContainerAwareTrait;
|
||||
use Testcontainer\Wait\WaitForNothing;
|
||||
use Testcontainer\Wait\WaitInterface;
|
||||
use Testcontainers\Exception\ContainerNotReadyException;
|
||||
use Testcontainers\Registry;
|
||||
use Testcontainers\Trait\DockerContainerAwareTrait;
|
||||
use Testcontainers\Wait\WaitForNothing;
|
||||
use Testcontainers\Wait\WaitInterface;
|
||||
|
||||
/**
|
||||
* @phpstan-type ContainerInspectSingleNetwork array<int, array{'NetworkSettings': array{'IPAddress': string}}>
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Container;
|
||||
namespace Testcontainers\Container;
|
||||
|
||||
use Testcontainer\Wait\WaitForExec;
|
||||
use Testcontainers\Wait\WaitForExec;
|
||||
|
||||
class MariaDBContainer extends Container
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Container;
|
||||
namespace Testcontainers\Container;
|
||||
|
||||
use Testcontainer\Wait\WaitForExec;
|
||||
use Testcontainers\Wait\WaitForExec;
|
||||
|
||||
class MySQLContainer extends Container
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Container;
|
||||
namespace Testcontainers\Container;
|
||||
|
||||
use Testcontainer\Wait\WaitForHttp;
|
||||
use Testcontainers\Wait\WaitForHttp;
|
||||
|
||||
class OpenSearchContainer extends Container
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Container;
|
||||
namespace Testcontainers\Container;
|
||||
|
||||
use Testcontainer\Wait\WaitForExec;
|
||||
use Testcontainers\Wait\WaitForExec;
|
||||
|
||||
class PostgresContainer extends Container
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Container;
|
||||
namespace Testcontainers\Container;
|
||||
|
||||
use Testcontainer\Wait\WaitForLog;
|
||||
use Testcontainers\Wait\WaitForLog;
|
||||
|
||||
class RedisContainer extends Container
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Exception;
|
||||
namespace Testcontainers\Exception;
|
||||
|
||||
class ContainerNotReadyException extends \RuntimeException
|
||||
{
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer;
|
||||
namespace Testcontainers;
|
||||
|
||||
use Testcontainer\Container\Container;
|
||||
use Testcontainers\Container\Container;
|
||||
|
||||
class Registry
|
||||
{
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Trait;
|
||||
namespace Testcontainers\Trait;
|
||||
|
||||
use JsonException;
|
||||
use Symfony\Component\Process\Process;
|
||||
use Testcontainer\Container\Container;
|
||||
use Testcontainers\Container\Container;
|
||||
use UnexpectedValueException;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Wait;
|
||||
namespace Testcontainers\Wait;
|
||||
|
||||
use Closure;
|
||||
use Symfony\Component\Process\Process;
|
||||
use Testcontainer\Exception\ContainerNotReadyException;
|
||||
use Testcontainers\Exception\ContainerNotReadyException;
|
||||
|
||||
class WaitForExec implements WaitInterface
|
||||
{
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Wait;
|
||||
namespace Testcontainers\Wait;
|
||||
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Process\Process;
|
||||
use Testcontainer\Exception\ContainerNotReadyException;
|
||||
use Testcontainers\Exception\ContainerNotReadyException;
|
||||
|
||||
class WaitForHealthCheck implements WaitInterface
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Wait;
|
||||
namespace Testcontainers\Wait;
|
||||
|
||||
use Testcontainer\Exception\ContainerNotReadyException;
|
||||
use Testcontainer\Trait\DockerContainerAwareTrait;
|
||||
use Testcontainers\Exception\ContainerNotReadyException;
|
||||
use Testcontainers\Trait\DockerContainerAwareTrait;
|
||||
|
||||
class WaitForHttp implements WaitInterface
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Wait;
|
||||
namespace Testcontainers\Wait;
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
use Testcontainer\Exception\ContainerNotReadyException;
|
||||
use Testcontainers\Exception\ContainerNotReadyException;
|
||||
|
||||
class WaitForLog implements WaitInterface
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Wait;
|
||||
namespace Testcontainers\Wait;
|
||||
|
||||
class WaitForNothing implements WaitInterface
|
||||
{
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Wait;
|
||||
namespace Testcontainers\Wait;
|
||||
|
||||
use JsonException;
|
||||
use RuntimeException;
|
||||
use Testcontainer\Exception\ContainerNotReadyException;
|
||||
use Testcontainer\Trait\DockerContainerAwareTrait;
|
||||
use Testcontainers\Exception\ContainerNotReadyException;
|
||||
use Testcontainers\Trait\DockerContainerAwareTrait;
|
||||
|
||||
final class WaitForTcpPortOpen implements WaitInterface
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Wait;
|
||||
namespace Testcontainers\Wait;
|
||||
|
||||
interface WaitInterface
|
||||
{
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Tests\Integration;
|
||||
namespace Testcontainers\Tests\Integration;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Predis\Client;
|
||||
use Testcontainer\Container\MariaDBContainer;
|
||||
use Testcontainer\Container\MySQLContainer;
|
||||
use Testcontainer\Container\OpenSearchContainer;
|
||||
use Testcontainer\Container\PostgresContainer;
|
||||
use Testcontainer\Container\RedisContainer;
|
||||
use Testcontainers\Container\MariaDBContainer;
|
||||
use Testcontainers\Container\MySQLContainer;
|
||||
use Testcontainers\Container\OpenSearchContainer;
|
||||
use Testcontainers\Container\PostgresContainer;
|
||||
use Testcontainers\Container\RedisContainer;
|
||||
|
||||
class ContainerTest extends TestCase
|
||||
{
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Testcontainer\Tests\Integration;
|
||||
namespace Testcontainers\Tests\Integration;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Predis\Client;
|
||||
use Predis\Connection\ConnectionException;
|
||||
use Symfony\Component\Process\Process;
|
||||
use Testcontainer\Container\Container;
|
||||
use Testcontainer\Exception\ContainerNotReadyException;
|
||||
use Testcontainer\Registry;
|
||||
use Testcontainer\Trait\DockerContainerAwareTrait;
|
||||
use Testcontainer\Wait\WaitForExec;
|
||||
use Testcontainer\Wait\WaitForHealthCheck;
|
||||
use Testcontainer\Wait\WaitForHttp;
|
||||
use Testcontainer\Wait\WaitForLog;
|
||||
use Testcontainer\Wait\WaitForTcpPortOpen;
|
||||
use Testcontainers\Container\Container;
|
||||
use Testcontainers\Exception\ContainerNotReadyException;
|
||||
use Testcontainers\Registry;
|
||||
use Testcontainers\Trait\DockerContainerAwareTrait;
|
||||
use Testcontainers\Wait\WaitForExec;
|
||||
use Testcontainers\Wait\WaitForHealthCheck;
|
||||
use Testcontainers\Wait\WaitForHttp;
|
||||
use Testcontainers\Wait\WaitForLog;
|
||||
use Testcontainers\Wait\WaitForTcpPortOpen;
|
||||
|
||||
class WaitStrategyTest extends TestCase
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user