Skip to content

Commit 0a3eaf1

Browse files
author
Bastian Schwarz
committed
Using plain nginx image since webdevops tries to do php stuff even in nginx image without php
Signed-off-by: Bastian Schwarz <bastian@repareo.de>
1 parent 4fcd164 commit 0a3eaf1

2 files changed

Lines changed: 49 additions & 17 deletions

File tree

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ services:
2525
environment:
2626
- SSH_AUTH_SOCK=/ssh-agent
2727
integrationtests.webserver:
28-
image: webdevops/nginx:alpine
28+
image: nginx:alpine
2929
volumes:
30-
- ./docker/integrationtests:/app
30+
- ./docker/integrationtests:/usr/share/nginx/html:ro
3131
ports:
3232
- "${INTEGRATION_TESTS_LOCAL_PORT_HTTP:-}:80"
3333
- "${INTEGRATION_TESTS_LOCAL_PORT_HTTPS:-}:443"

test/integration/RunTestsOnHttpResponseTest.php

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
namespace de\codenamephp\deploymentchecks\http\test\integration;
1919

20+
use de\codenamephp\deploymentchecks\base\Check\Collection\SequentialCheckCollection;
21+
use de\codenamephp\deploymentchecks\base\Check\Result\Collection\ResultCollection;
2022
use de\codenamephp\deploymentchecks\http\HttpCheckResult;
2123
use de\codenamephp\deploymentchecks\http\RunTestsOnHttpResponse;
2224
use de\codenamephp\deploymentchecks\http\Test\Result\HttpTestResult;
@@ -25,23 +27,53 @@
2527
use GuzzleHttp\Psr7\Request;
2628
use PHPUnit\Framework\TestCase;
2729

28-
final class RunTestsOnHttpResponseTest extends TestCase
29-
{
30+
final class RunTestsOnHttpResponseTest extends TestCase {
3031

31-
public function testCanRunSuccessfulTest(): void
32-
{
32+
public function testCanRunSuccessfulTest() : void {
33+
$check = new RunTestsOnHttpResponse(
34+
new Request('GET', new BaseUri() . '/test.html'),
35+
'Test',
36+
new StatusCode(200),
37+
);
3338

34-
$check = new RunTestsOnHttpResponse(
35-
new Request('GET', new BaseUri() . '/test.html'),
36-
'Test',
37-
new StatusCode(200),
38-
);
39+
$result = $check->run();
3940

40-
$result = $check->run();
41+
self::assertInstanceOf(HttpCheckResult::class, $result);
42+
self::assertTrue($result->successful());
43+
self::assertSame('Test', $result->name());
44+
self::assertContainsEquals(new HttpTestResult(true, "Expected response code '200' got '200'"), $result->testResults->results);
45+
}
4146

42-
self::assertInstanceOf(HttpCheckResult::class, $result);
43-
self::assertTrue($result->successful());
44-
self::assertSame('Test', $result->name());
45-
self::assertContainsEquals(new HttpTestResult(true, "Expected response code '200' got '200'"), $result->testResults->results);
46-
}
47+
public function testCanRunSuccessfulTestCollection() : void {
48+
$check = new SequentialCheckCollection(new RunTestsOnHttpResponse(
49+
new Request('GET', new BaseUri() . '/test.html'),
50+
'Exists',
51+
new StatusCode(200),
52+
),
53+
new RunTestsOnHttpResponse(
54+
new Request('GET', new BaseUri() . '/404.html'),
55+
'Does not exist',
56+
new StatusCode(404),
57+
),
58+
);
59+
60+
$result = $check->run();
61+
62+
self::assertInstanceOf(ResultCollection::class, $result);
63+
self::assertTrue($result->successful());
64+
65+
self::assertEquals(
66+
[
67+
new HttpCheckResult(
68+
'Exists',
69+
new HttpTestResult(true, "Expected response code '200' got '200'"),
70+
),
71+
new HttpCheckResult(
72+
'Does not exist',
73+
new HttpTestResult(true, "Expected response code '404' got '404'"),
74+
),
75+
],
76+
$result->results,
77+
);
78+
}
4779
}

0 commit comments

Comments
 (0)