feat: rename package name

This commit is contained in:
Soner Sayakci
2024-07-30 21:22:22 +02:00
parent 0005627e14
commit bf762350e9
24 changed files with 98 additions and 71 deletions
+5 -3
View File
@@ -2,9 +2,11 @@ name: PHP
on:
push:
branches: [ "main" ]
branches:
- main
pull_request:
branches: [ "main" ]
branches:
- main
permissions:
contents: read
@@ -14,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
+2 -1
View File
@@ -1,3 +1,4 @@
/vendor/
.php-cs-fixer.cache
/.php-cs-fixer.cache
/.phpunit.cache
/composer.lock
+8 -10
View File
@@ -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
View File
@@ -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": {
View File
+26
View File
@@ -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>
+6 -6
View File
@@ -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 -2
View File
@@ -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 -2
View File
@@ -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 -2
View File
@@ -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 -2
View File
@@ -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 -2
View File
@@ -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
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Testcontainer\Exception;
namespace Testcontainers\Exception;
class ContainerNotReadyException extends \RuntimeException
{
+2 -2
View File
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace Testcontainer;
namespace Testcontainers;
use Testcontainer\Container\Container;
use Testcontainers\Container\Container;
class Registry
{
+2 -2
View File
@@ -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 -2
View File
@@ -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 -2
View File
@@ -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
{
+3 -3
View File
@@ -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 -2
View File
@@ -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
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Testcontainer\Wait;
namespace Testcontainers\Wait;
class WaitForNothing implements WaitInterface
{
+3 -3
View File
@@ -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
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Testcontainer\Wait;
namespace Testcontainers\Wait;
interface WaitInterface
{
+6 -6
View File
@@ -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
{
+10 -10
View File
@@ -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
{