Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/website/node_modules/
.DS_Store
/.serverless/
.phpunit.result.cache
.phpunit.cache
node_modules/
package-lock.json
.claude
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@
"psr/http-message": "^1.0|^2.0",
"psr/http-server-handler": "^1.0",
"riverline/multipart-parser": "^2.1.2",
"symfony/process": "^5.4|^6.4|^7.0|^8.0"
"symfony/process": "^6.4|^7.0|^8.0"
},
"require-dev": {
"async-aws/core": "^1.0",
"async-aws/lambda": "^1.0",
"async-aws/lambda": "^2.0",
"aws/aws-sdk-php": "^3.172",
"bref/secrets-loader": "^1.0",
"dms/phpunit-arraysubset-asserts": "^0.4",
"dms/phpunit-arraysubset-asserts": "^0.5",
"doctrine/coding-standard": "^8.0",
"guzzlehttp/guzzle": "^7.5",
"phpstan/phpstan": "^1.10.26",
"phpunit/phpunit": "^9.6.10",
"symfony/console": "^5.4|^6.4|^7.0|^8.0",
"symfony/yaml": "^5.4|^6.4|^7.0|^8.0"
"phpstan/phpstan": "^2",
"phpunit/phpunit": "^10.1",
"symfony/console": "^6.4|^7.0|^8.0",
"symfony/yaml": "^6.4|^7.0|^8.0"
},
"scripts": {
"test": [
Expand Down
16 changes: 9 additions & 7 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="./vendor/autoload.php">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="./vendor/autoload.php" cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="small">
<directory>./tests/</directory>
<exclude>./tests/Sam</exclude>
<exclude>./tests/Fixtures</exclude>
<exclude>./tests/HttpRequestProxyTest.php</exclude>
<exclude>./tests/Event/Http/CommonHttpTest.php</exclude>
</testsuite>
<testsuite name="runtimes">
<directory>./tests/Sam</directory>
</testsuite>
</testsuites>
<php>
<env name="AWS_REGION" value="eu-west-1" force="true" />
<env name="AWS_REGION" value="eu-west-1" force="true"/>
</php>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/FpmRuntime/FpmHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ final class FpmHandler extends HttpHandler
*/
private const SIGTERM = 15;

private ?Client $client;
private ?Client $client = null;
private UnixDomainSocket $connection;
private string $handler;
private string $configFile;
Expand Down
6 changes: 2 additions & 4 deletions src/Runtime/LambdaRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@
*/
final class LambdaRuntime
{
/** @var resource|CurlHandle|null */
private $curlHandleNext;
/** @var resource|CurlHandle|null */
private $curlHandleResult;
private ?CurlHandle $curlHandleNext = null;
private ?CurlHandle $curlHandleResult = null;
private string $apiUrl;
private Invoker $invoker;
private string $layer;
Expand Down
4 changes: 2 additions & 2 deletions tests/Event/Http/CommonHttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

abstract class CommonHttpTest extends TestCase implements HttpRequestProxyTest
{
public function provide API Gateway versions(): array
public static function provide API Gateway versions(): array
{
return [
'v1' => [1],
Expand Down Expand Up @@ -232,7 +232,7 @@ public function test POST request with form data and content type(int $v
]);
}

public function provideHttpMethodsWithRequestBodySupport(): array
public static function provideHttpMethodsWithRequestBodySupport(): array
{
return [
'POST v1' => [
Expand Down
4 changes: 2 additions & 2 deletions tests/Event/Http/HttpRequestEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function test query string to array(string $query, array $expectedOut
$this->assertEquals($expectedOutput, $result);
}

public function provide query strings(): iterable
public static function provide query strings(): iterable
{
yield ['', []];

Expand Down Expand Up @@ -248,7 +248,7 @@ public function test query string will be parsed correctly(array $expected
self::assertSame($normalizedQs, $event->getQueryString());
}

public function provide query strings for event(): array
public static function provide query strings for event(): array
{
return [
[['foo' => 'bar'], 'foo=bar', 'foo=bar'],
Expand Down
6 changes: 3 additions & 3 deletions tests/FpmRuntime/FpmHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function tearDown(): void
ob_end_clean();
}

public function provide API Gateway versions(): array
public static function provide API Gateway versions(): array
{
return [
'v1' => [1],
Expand Down Expand Up @@ -480,7 +480,7 @@ public function test POST request with form data and content type(int $v
]);
}

public function provideHttpMethodsWithRequestBodySupport(): array
public static function provideHttpMethodsWithRequestBodySupport(): array
{
return [
'POST v1' => [
Expand Down Expand Up @@ -1133,7 +1133,7 @@ public function test response with status code(int $expectedStatusCode)
self::assertEquals($expectedStatusCode, $statusCode);
}

public function provideStatusCodes(): array
public static function provideStatusCodes(): array
{
return [[200], [301], [302], [400], [401], [403], [404], [500], [504]];
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Runtime/LambdaRuntimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public function afterInvoke(mixed ...$params): void
// The error response was already sent, it contains the handler error
$this->assertInvocationErrorResult('Exception', 'Invocation error');
// The logs should contain both the handler error and the afterInvoke error
$this->assertStringContainsString('Invoke Error {"errorType":"Exception","errorMessage":"Invocation error","stack":', $this->getActualOutput());
$this->assertStringContainsString('Invoke Error {"errorType":"Exception","errorMessage":"This is an exception in afterInvoke","stack":', $this->getActualOutput());
$this->assertStringContainsString('Invoke Error {"errorType":"Exception","errorMessage":"Invocation error","stack":', $this->output());
$this->assertStringContainsString('Invoke Error {"errorType":"Exception","errorMessage":"This is an exception in afterInvoke","stack":', $this->output());
}
}
4 changes: 2 additions & 2 deletions tests/RuntimeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected function assertInvocationErrorResult(string $errorClass, string $error
protected function assertErrorInLogs(string $errorClass, string $errorMessage): void
{
// Decode the logs from stdout
$stdout = $this->getActualOutput();
$stdout = $this->output();

[$requestId, $message, $json] = explode("\t", $stdout);

Expand Down Expand Up @@ -108,7 +108,7 @@ protected function assertErrorInLogs(string $errorClass, string $errorMessage):
protected function assertPreviousErrorsInLogs(array $previousErrors): void
{
// Decode the logs from stdout
$stdout = $this->getActualOutput();
$stdout = $this->output();

[, , $json] = explode("\t", $stdout);

Expand Down
Loading