1
0
mirror of synced 2024-11-23 13:36:06 +03:00

Environment to run test locally

This commit is contained in:
Ilyas Salikhov 2024-01-27 19:36:37 +03:00
parent 5158cf22b3
commit 68df0e1f49
4 changed files with 34 additions and 11 deletions

6
Dockerfile Normal file
View File

@ -0,0 +1,6 @@
ARG PHP_IMAGE_TAG
FROM php:${PHP_IMAGE_TAG}-cli-alpine
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /opt/test

16
Makefile Normal file
View File

@ -0,0 +1,16 @@
ifneq (,$(shell (type docker-compose 2>&1 >/dev/null && echo 1) || true))
PHP=docker-compose run --rm --no-deps php
else
PHP=php
endif
PHP_CONSOLE_DEPS=vendor
vendor: composer.json
@$(PHP) composer install -o -n --no-ansi
@touch vendor || true
phpunit: $(PHP_CONSOLE_DEPS)
@$(PHP) vendor/bin/phpunit --color=always
check: phpunit

11
docker-compose.yml Normal file
View File

@ -0,0 +1,11 @@
version: '3.4'
services:
php:
build:
context: .
args:
PHP_IMAGE_TAG: ${PHP_IMAGE_TAG:-7.4}
volumes:
- "./:/opt/test"

View File

@ -1,13 +1,3 @@
<?php
use Composer\Autoload\ClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;
/**
* @var ClassLoader $loader
*/
$loader = require __DIR__.'/../vendor/autoload.php';
AnnotationRegistry::registerLoader('class_exists');
return $loader;
return require __DIR__.'/../vendor/autoload.php';