Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Update migration and model generation #9

Merged
merged 22 commits into from
Aug 3, 2020
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
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/.idea
/.git
/tests/tmp/*
/vendor
/.dockerignore
/.editorconfig
/.env
/.env.dist
/.gitattributes
/.gitignore
/.php_cs.cache
/composer.lock
/Makefile
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ php:
- '7.1'
- '7.2'
- '7.3'
- nightly
# - '7.4'

install: make install
install:
- travis_retry composer self-update && composer --version
- travis_retry composer install --prefer-dist --no-interaction
script:
- make test
- if [[ $TRAVIS_PHP_VERSION = "7.3" || $TRAVIS_PHP_VERSION = "nightly" ]]; then true; else make check-style; fi
- if [[ $TRAVIS_PHP_VERSION = "7.3" || $TRAVIS_PHP_VERSION = "7.4" ]]; then true; else make check-style; fi
27 changes: 26 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,30 @@ install:
test:
php $(PHPARGS) vendor/bin/phpunit

.PHONY: all check-style fix-style install test
clean_all:
docker-compose down
sudo rm -rf tests/tmp/*

clean:
sudo rm -rf tests/tmp/app/*
sudo rm -rf tests/tmp/docker_app/*

up:
docker-compose up -d

cli:
docker-compose exec php bash

migrate:
mkdir -p "tests/tmp/app"
mkdir -p "tests/tmp/docker_app"
docker-compose run --rm php sh -c 'cd /app/tests && ./yii migrate --interactive=0'

installdocker:
docker-compose run --rm php composer install && chmod +x tests/yii

testdocker:
docker-compose run --rm php sh -c 'vendor/bin/phpunit tests/unit'

.PHONY: all check-style fix-style install test clean clean_all up cli installdocker migrate testdocker

9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
},
"require": {
"php": ">=7.1.0",
"cebe/php-openapi": "^1.5",
"cebe/php-openapi": "dev-wip-reference-cache as 1.5",
"yiisoft/yii2": "~2.0.15",
"yiisoft/yii2-gii": "~2.0.0 | ~2.1.0",
"yiisoft/yii2-gii": "~2.0.0 | ~2.1.0| ~2.2.0",
"fzaninotto/faker": "^1.8",
"laminas/laminas-code": "^3.4"
},
Expand All @@ -36,6 +36,11 @@
"cebe\\yii2openapi\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"tests\\": "tests/"
}
},
"config": {
"platform": {
"php": "7.1.3"
Expand Down
68 changes: 68 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
version: "3.5"
services:
php:
build:
dockerfile: tests/docker/Dockerfile
context: .
volumes:
- ./tests/tmp/.composer:/root/.composer:rw
- .:/app
environment:
- TZ=UTC
- TIMEZONE=UTC
- DB_USER=dbuser
- DB_PASSWORD=dbpass
- IN_DOCKER=docker
depends_on:
- mysql
- postgres
- maria
tty: true
networks:
net: {}
mysql:
image: mysql:5.7
ports:
- '13306:3306'
volumes:
- ./tests/tmp/mysql:/var/lib/mysql:rw
environment:
TZ: UTC
MYSQL_ALLOW_EMPTY_PASSWORD: 1
MYSQL_USER: dbuser
MYSQL_PASSWORD: dbpass
MYSQL_DATABASE: testdb
networks:
net: {}
maria:
image: mariadb
ports:
- '23306:3306'
volumes:
- ./tests/tmp/maria:/var/lib/mysql:rw
environment:
TZ: UTC
MYSQL_ALLOW_EMPTY_PASSWORD: 1
MYSQL_USER: dbuser
MYSQL_PASSWORD: dbpass
MYSQL_DATABASE: testdb
MYSQL_INITDB_SKIP_TZINFO: 1
networks:
net: {}
postgres:
image: postgres:12
ports:
- '15432:5432'
volumes:
- ./tests/tmp/postgres:/var/lib/postgresql/data:rw
environment:
TZ: UTC
PGTZ: UTC
POSTGRES_USER: dbuser
POSTGRES_PASSWORD: dbpass
POSTGRES_DB: testdb
networks:
net: {}

networks:
net: {}
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
stopOnFailure="false">
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
<directory suffix="Test.php">./tests/unit</directory>
</testsuite>
</testsuites>
<filter>
Expand Down
Loading