-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
477 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
version: "3.7" | ||
services: | ||
squirrel_queries_coverage: | ||
image: thecodingmachine/php:7.4-v3-cli | ||
container_name: squirrel_queries_coverage | ||
tty: true | ||
working_dir: /usr/src/app | ||
# --path-coverage could be added later, it is much too slow currently and only supported by xdebug | ||
command: [ "vendor/bin/phpunit", "--colors=always", "--stop-on-defect", "--coverage-html", "tests/_reports"] | ||
volumes: | ||
- ./src:/usr/src/app/src | ||
- ./tests:/usr/src/app/tests | ||
- ./composer.json:/usr/src/app/composer.json | ||
- ./phpunit.xml.dist:/usr/src/app/phpunit.xml.dist | ||
- ./vendor-bin:/usr/src/app/vendor-bin | ||
environment: | ||
# We currently use PCOV because it is at least 8x faster | ||
# - 3 seconds compared to 23 seconds (or 5 minutes with path coverage enabled) | ||
PHP_EXTENSION_XDEBUG: 1 | ||
#PHP_EXTENSION_PCOV: 1 | ||
PHP_EXTENSION_APCU: 0 | ||
PHP_EXTENSION_REDIS: 0 | ||
PHP_EXTENSION_SQLITE3: 1 | ||
PHP_EXTENSION_PDO_MYSQL: 1 | ||
PHP_EXTENSION_PDO_PGSQL: 1 | ||
PHP_EXTENSION_PDO_SQLITE: 1 | ||
PHP_INI_MEMORY_LIMIT: 1g | ||
PHP_INI_ERROR_REPORTING: E_ALL | ||
SQUIRREL_TEST_SQLITE: 'sqlite:///:memory:' | ||
SQUIRREL_TEST_POSTGRES: 'postgres://user:password@squirrel_queries_postgres/postgres?charset=UTF-8' | ||
SQUIRREL_TEST_MYSQL: 'mysql://user:password@squirrel_queries_mysql/shop' | ||
SQUIRREL_TEST_MARIADB: 'mysql://user:password@squirrel_queries_mariadb/shop' | ||
STARTUP_COMMAND_1: composer update --no-scripts --quiet | ||
STARTUP_COMMAND_2: rm -rf /usr/src/app/tests/_reports/* | ||
depends_on: | ||
- squirrel_queries_postgres | ||
- squirrel_queries_mysql | ||
- squirrel_queries_mariadb | ||
|
||
squirrel_queries_postgres: | ||
image: postgres:latest | ||
container_name: squirrel_queries_postgres | ||
environment: | ||
POSTGRES_USER: 'user' | ||
POSTGRES_PASSWORD: 'password' | ||
|
||
squirrel_queries_mysql: | ||
image: mysql/mysql-server:latest | ||
container_name: squirrel_queries_mysql | ||
command: --default-authentication-plugin=mysql_native_password | ||
environment: | ||
MYSQL_ROOT_PASSWORD: 'whatever' | ||
MYSQL_DATABASE: 'shop' | ||
MYSQL_USER: 'user' | ||
MYSQL_PASSWORD: 'password' | ||
|
||
squirrel_queries_mariadb: | ||
image: mariadb:latest | ||
container_name: squirrel_queries_mariadb | ||
environment: | ||
MYSQL_ROOT_PASSWORD: 'whatever' | ||
MYSQL_DATABASE: 'shop' | ||
MYSQL_USER: 'user' | ||
MYSQL_PASSWORD: 'password' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
# Get directory of this script | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
# Remove all running docker containers | ||
docker-compose -f "$DIR/compose-coverage.yml" --project-directory "$DIR/.." down -v --remove-orphans | ||
|
||
# Test SQLite and real live tests with PostgreSQL and MySQL | ||
docker-compose -f "$DIR/compose-coverage.yml" --project-directory "$DIR/.." up --build --force-recreate --renew-anon-volumes squirrel_queries_coverage | ||
|
||
# Remove all running docker containers | ||
docker-compose -f "$DIR/compose-coverage.yml" --project-directory "$DIR/.." down -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.1/phpunit.xsd" | ||
backupGlobals="false" | ||
colors="true" | ||
bootstrap="vendor/autoload.php" | ||
> | ||
<testsuites> | ||
<testsuite name="Unit Tests"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">src</directory> | ||
<exclude> | ||
<directory>src/TestHelpers</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php"> | ||
<coverage> | ||
<include> | ||
<directory suffix=".php">src</directory> | ||
</include> | ||
<exclude> | ||
<directory>src/TestHelpers</directory> | ||
</exclude> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="Unit Tests"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.