Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync main #25

Merged
merged 23 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
28 changes: 28 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Tests"

on: [ pull_request ]
jobs:
test:
name: Tests ${{ matrix.php-versions }}
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.0', '8.1', '8.2', '8.3', 'nightly']

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Compose install
run: composer install --ignore-platform-reqs

- name: Run tests
run: composer test
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

53 changes: 0 additions & 53 deletions Dockerfile

This file was deleted.

5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
},
"autoload-dev": {
"psr-4": {
"Utopia\\Tests\\": "tests/Platform"
"Utopia\\Tests\\": "tests/Platform",
"Utopia\\Unit\\": "tests/unit"
}
},
"require": {
Expand All @@ -28,6 +29,6 @@
"scripts": {
"format": "vendor/bin/pint",
"lint": "vendor/bin/pint --test",
"test": "docker-compose up -d && sleep 10 && docker-compose exec web vendor/bin/phpunit --configuration phpunit.xml"
"test": "vendor/bin/phpunit --configuration phpunit.xml"
}
}
10 changes: 0 additions & 10 deletions docker-compose.yml

This file was deleted.

4 changes: 3 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
stopOnFailure="false"
>
<testsuites>
<testsuite name="unit">
<directory>./tests/unit</directory>
</testsuite>
<testsuite name="Application Test Suite">
<file>./tests/e2e/Client.php</file>
<directory>./tests/</directory>
</testsuite>
</testsuites>
Expand Down
14 changes: 14 additions & 0 deletions src/Platform/Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,4 +341,18 @@ public function setWorker(Server $worker): self

return $this;
}

/**
* Get env
*
* Method for querying env parameters. If $key is not found $default value will be returned.
*
* @param string $key
* @param string|null $default
* @return mixed
*/
public function getEnv(string $key, string $default = null): mixed
{
return $_SERVER[$key] ?? $default;
}
}
32 changes: 32 additions & 0 deletions tests/Platform/MockResponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace Utopia\Tests;

use Utopia\Response;

class MockResponse extends Response
{
public function end(string $content = null): void
{
if (! is_null($content)) {
echo $content;
}
}

public function send(string $body = ''): void
{
$this->sent = true;
$this->end($body);
}

public function chunk(string $body = '', bool $end = false): void
{
if ($end) {
$this->sent = true;
}
$this->write($body);
if ($end) {
$this->end();
}
}
}
87 changes: 0 additions & 87 deletions tests/docker/nginx.conf

This file was deleted.

25 changes: 0 additions & 25 deletions tests/docker/start

This file was deleted.

45 changes: 0 additions & 45 deletions tests/docker/supervisord.conf

This file was deleted.

Loading
Loading