Skip to content

Commit b6c7306

Browse files
committed
Run PHPUnit in Standalone image tests
1 parent bb59d33 commit b6c7306

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace CodedMonkey\Dirigent\Tests\Docker\Standalone;
4+
5+
use PHPUnit\Framework\TestCase;
6+
use Testcontainers\Container\GenericContainer;
7+
use Testcontainers\Wait\WaitForLog;
8+
9+
class PhpunitTest extends TestCase
10+
{
11+
public function testPhpunitTests(): void
12+
{
13+
$container = (new GenericContainer('dirigent-standalone'))
14+
->withCommand(['bin/phpunit'])
15+
->withMount(__DIR__ . '/.env.dirigent.test', '/srv/app/.env.dirigent.test')
16+
->withMount(__DIR__ . '/bin/phpunit', '/srv/app/bin/phpunit')
17+
->withMount(__DIR__ . '/phpunit.dist.xml', '/srv/app/phpunit.dist.xml')
18+
->withMount(__DIR__ . '/vendor', '/srv/app/vendor')
19+
->withWait(new WaitForLog('Time:'))
20+
->start();
21+
22+
$result = $container->logs();
23+
24+
$container->stop();
25+
26+
$this->assertStringContainsString('OK', $result, 'Running the PHPUnit tests inside ');
27+
}
28+
}

0 commit comments

Comments
 (0)