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
2 changes: 1 addition & 1 deletion Dockerfile.swoole
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN composer install --ignore-platform-reqs --optimize-autoloader \
--no-plugins --no-scripts --prefer-dist \
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`

FROM appwrite/base:0.5.0 AS final
FROM appwrite/base:1.2.0 AS final
LABEL maintainer="team@appwrite.io"

WORKDIR /usr/src/code
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
"require-dev": {
"doctrine/instantiator": "^1.5",
"laravel/pint": "1.*",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^9.5.25",
"rector/rector": "^2.0",
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^12.0",
"rector/rector": "^2.4",
"swoole/ide-helper": "4.8.3"
}
}
719 changes: 331 additions & 388 deletions composer.lock

Large diffs are not rendered by default.

44 changes: 21 additions & 23 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
<testsuites>
<testsuite name="unit">
<directory>./tests</directory>
<exclude>./tests/e2e</exclude>
</testsuite>
<testsuite name="e2e-fpm">
<file>./tests/e2e/ResponseFPMTest.php</file>
</testsuite>
<testsuite name="e2e-swoole">
<file>./tests/e2e/ResponseSwooleTest.php</file>
</testsuite>
</testsuites>
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="unit">
<directory>./tests</directory>
<exclude>./tests/e2e</exclude>
<exclude>./tests/BaseTest.php</exclude>
<exclude>./tests/UtopiaFPMRequestTest.php</exclude>
</testsuite>
<testsuite name="e2e-fpm">
<file>./tests/e2e/ResponseFPMTest.php</file>
</testsuite>
<testsuite name="e2e-swoole">
<file>./tests/e2e/ResponseSwooleTest.php</file>
</testsuite>
</testsuites>
<source>
<include>
<directory>./src</directory>
</include>
</source>
</phpunit>
18 changes: 10 additions & 8 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Php82\Rector\Class_\ReadOnlyClassRector;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;

return RectorConfig::configure()
->withPaths([
Expand All @@ -34,6 +33,11 @@
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
PHPUnitSetList::PHPUNIT_100,
PHPUnitSetList::PHPUNIT_110,
PHPUnitSetList::PHPUNIT_120,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
])
->withImportNames(importShortClasses: false, removeUnusedImports: true)
->withSkip([
Expand All @@ -45,11 +49,6 @@
ExplicitBoolCompareRector::class,
SimplifyEmptyCheckOnEmptyArrayRector::class,

// Can throw TypeError on previously-working callers (library is public API)
TypedPropertyFromAssignsRector::class,
TypedPropertyFromStrictConstructorRector::class,
ParamTypeByParentCallTypeRector::class,

// Different distribution and failure mode than rand()
RandomFunctionRector::class,

Expand All @@ -68,4 +67,7 @@

// Throws TypeError when args are objects/arrays — review per-call
NullToStrictStringFuncCallArgRector::class,

// Weakens `assertNull` to `assertNotInstanceOf` — keep the stricter assertion
AssertEmptyNullableObjectToAssertInstanceofRector::class,
]);
20 changes: 10 additions & 10 deletions tests/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,39 @@ trait BaseTest
public function testResponse(): void
{
$response = $this->client->call(Client::METHOD_GET, '/');
$this->assertEquals('Hello World!', $response['body']);
$this->assertSame('Hello World!', $response['body']);
}

public function testResponseValue(): void
{
$response = $this->client->call(Client::METHOD_GET, '/value/123');
$this->assertEquals('123', $response['body']);
$this->assertSame('123', $response['body']);
}

public function testChunkResponse(): void
{
$response = $this->client->call(Client::METHOD_GET, '/chunked');
$this->assertEquals('Hello World!', $response['body']);
$this->assertSame('Hello World!', $response['body']);
}

public function testRedirect(): void
{
$response = $this->client->call(Client::METHOD_GET, '/redirect');
$this->assertEquals('Hello World!', $response['body']);
$this->assertSame('Hello World!', $response['body']);
}

public function testFile(): void
{
$response = $this->client->call(Client::METHOD_GET, '/humans.txt');
$this->assertEquals(204, $response['headers']['status-code']);
$this->assertSame(204, $response['headers']['status-code']);
}

public function testSetCookie(): void
{
$response = $this->client->call(Client::METHOD_GET, '/set-cookie');
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('value1', $response['cookies']['key1']);
$this->assertEquals('value2', $response['cookies']['key2']);
$this->assertSame(200, $response['headers']['status-code']);
$this->assertSame('value1', $response['cookies']['key1']);
$this->assertSame('value2', $response['cookies']['key2']);
}

public function testAliases(): void
Expand All @@ -50,8 +50,8 @@ public function testAliases(): void

foreach ($paths as $path) {
$response = $this->client->call(Client::METHOD_GET, $path);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('Aliased!', $response['body']);
$this->assertSame(200, $response['headers']['status-code']);
$this->assertSame('Aliased!', $response['body']);
}
}
}
Loading
Loading