diff --git a/.docker/php53/Dockerfile b/.docker/php53/Dockerfile new file mode 100644 index 000000000..fa7261082 --- /dev/null +++ b/.docker/php53/Dockerfile @@ -0,0 +1,48 @@ +FROM buildpack-deps:jessie + +ENV PHP_VERSION 5.3.29 + +# php 5.3 needs older autoconf +RUN set -eux; \ + \ + apt-get update; \ + apt-get install -y \ + curl \ + autoconf2.13 \ + ; \ + rm -r /var/lib/apt/lists/*; \ + \ + curl -sSLfO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb; \ + curl -sSLfO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb; \ + dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb; \ + dpkg -i bison_2.7.1.dfsg-1_amd64.deb; \ + rm *.deb; \ + \ + curl -sSLf "https://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2; \ + echo 'c4e1cf6972b2a9c7f2777a18497d83bf713cdbecabb65d3ff62ba441aebb0091 php.tar.bz2' | sha256sum -cw --status; \ + \ + mkdir -p /usr/src/php; \ + tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1; \ + rm php.tar.bz2*; \ + \ + cd /usr/src/php; \ + ./buildconf --force; \ + ./configure --disable-cgi \ + $(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \ + --with-pdo-mysql \ + --with-zlib \ + --enable-mbstring \ + ; \ + make -j"$(nproc)"; \ + make install; \ + \ + dpkg -r \ + bison \ + libbison-dev \ + ; \ + apt-get purge -y --auto-remove \ + autoconf2.13 \ + ; \ + rm -r /usr/src/php + +CMD ["php", "-a"] diff --git a/.docker/php54/Dockerfile b/.docker/php54/Dockerfile new file mode 100644 index 000000000..91baa8c85 --- /dev/null +++ b/.docker/php54/Dockerfile @@ -0,0 +1,5 @@ +FROM php:5.4-cli + +RUN docker-php-ext-install pdo +RUN docker-php-ext-install pdo_mysql +RUN docker-php-ext-install mbstring diff --git a/.docker/php55_71/Dockerfile b/.docker/php55_71/Dockerfile new file mode 100644 index 000000000..7c901b83a --- /dev/null +++ b/.docker/php55_71/Dockerfile @@ -0,0 +1,6 @@ +ARG PHP_TAG +FROM php:${PHP_TAG} + +RUN docker-php-ext-install pdo +RUN docker-php-ext-install pdo_mysql +RUN docker-php-ext-install mbstring diff --git a/.docker/php72_73/Dockerfile b/.docker/php72_73/Dockerfile new file mode 100644 index 000000000..1cc2965f5 --- /dev/null +++ b/.docker/php72_73/Dockerfile @@ -0,0 +1,22 @@ +ARG PHP_VERSION +FROM php:${PHP_VERSION}-cli + +RUN docker-php-ext-install pdo +RUN docker-php-ext-install pdo_mysql +RUN docker-php-ext-install mbstring + +# For consistent mime type file guesser +RUN set -eux; \ + distFilePath=`which file`; \ + \ + mv ${distFilePath} ${distFilePath}.dist; \ + { \ + echo '#! /bin/sh -eu'; \ + echo ''; \ + echo "${distFilePath}"'.dist "$@" | sed -e s,application/x-pie-executable,application/x-executable,g'; \ + } | tee ${distFilePath}; \ + \ + chmod +x ${distFilePath}; \ + \ + file /bin/ls --mime | grep application/x-executable; \ + :; diff --git a/.docker/php74_81/Dockerfile b/.docker/php74_81/Dockerfile new file mode 100644 index 000000000..7d13d7c82 --- /dev/null +++ b/.docker/php74_81/Dockerfile @@ -0,0 +1,34 @@ +ARG PHP_VERSION +FROM php:${PHP_VERSION}-cli + +RUN docker-php-ext-install pdo +RUN docker-php-ext-install pdo_mysql + +# Install mbstring PHP extension +# +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-upgrade --no-install-recommends \ + libonig-dev \ + ; \ + \ + apt-get clean; \ + rm -rf /var/lib/apt/lists/*; \ + \ + docker-php-ext-install mbstring + +# For consistent mime type file guesser +RUN set -eux; \ + distFilePath=`which file`; \ + \ + mv ${distFilePath} ${distFilePath}.dist; \ + { \ + echo '#! /bin/sh -eu'; \ + echo ''; \ + echo "${distFilePath}"'.dist "$@" | sed -e s,application/x-pie-executable,application/x-executable,g'; \ + } | tee ${distFilePath}; \ + \ + chmod +x ${distFilePath}; \ + \ + file /bin/ls --mime | grep application/x-executable; \ + :; diff --git a/.gitignore b/.gitignore index 86bb5269c..4a2fca764 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ tests/DoctrineTest/doctrine_tests/* *TestCase.php +/composer.lock /tests/tmp /tests/foo.sq3 +/vendor/ diff --git a/README.md b/README.md new file mode 100644 index 000000000..eede636ae --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +Doctrine1 +========= + +About this version +------------------ + +This is a community driven fork of doctrine 1, as official support has been interrupted long time ago. + +**Do not use it for new projects: this version is great to improve existing symfony1 applications using doctrine1, but [Doctrine2](https://www.doctrine-project.org/projects/orm.html) is the way to go today.** + + +Requirements +------------ + +PHP 5.3 and up. + + +Installation +------------ + +Using [Composer](http://getcomposer.org/doc/00-intro.md) as dependency management: + + composer require friendsofsymfony1/doctrine1 "1.5.*" + composer install + + + +Tests +----- + +### Prerequisites + + * docker-engine version 17.12.0+ + * docker-compose version 1.20.0+ + +### How to execute all tests on all supported PHP versions and dependencies? + + tests/bin/test + +### When you finish your work day, do not forget to clean up your desk + + docker-compose down + + +Documentation +------------- + +Read the official [doctrine1 documentation](https://web.archive.org/web/20171008235327/http://docs.doctrine-project.org:80/projects/doctrine1/en/latest/en/manual/index.html) + + +Contributing +------------ + +You can send pull requests or create an issue. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..98dfe7ab4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,138 @@ +version: '3.5' + +volumes: + db_socket: + +services: + composer: + image: composer + working_dir: /app + volumes: + - .:/app + entrypoint: + - sh + - -c + - | + exec tail -f /dev/null + + php53: + build: .docker/php53 + working_dir: /app/tests + volumes: + - .:/app + - db_socket:/var/run/mysqld + entrypoint: + - sh + - -c + - | + { + echo 'pdo_mysql.default_socket = /var/run/mysqld/mysql.sock' + echo 'memory_limit = -1' + echo 'short_open_tag = off' + echo 'magic_quotes_gpc = off' + echo 'date.timezone = "UTC"' + } | tee -a /usr/local/lib/php.ini + + exec tail -f /dev/null + + php54: &services_php54 + build: + context: .docker/php54 + working_dir: /app/tests + volumes: + - .:/app + - db_socket:/var/run/mysqld + entrypoint: + - sh + - -c + - | + { + echo 'pdo_mysql.default_socket = /var/run/mysqld/mysql.sock' + echo 'memory_limit = -1' + echo 'short_open_tag = off' + echo 'magic_quotes_gpc = off' + echo 'date.timezone = "UTC"' + } | tee -a /usr/local/etc/php/php.ini + + exec tail -f /dev/null + depends_on: + - db + + php55: + <<: *services_php54 + build: + context: .docker/php55_71 + args: + PHP_TAG: '5.5-cli' + + php56: + <<: *services_php54 + build: + context: .docker/php55_71 + args: + PHP_TAG: '5.6-cli-jessie' + + php70: + <<: *services_php54 + build: + context: .docker/php55_71 + args: + PHP_TAG: '7.0-cli-jessie' + + php71: + <<: *services_php54 + build: + context: .docker/php55_71 + args: + PHP_TAG: '7.1-cli-jessie' + + php72: + <<: *services_php54 + build: + context: .docker/php72_73 + args: + PHP_VERSION: '7.2' + + php73: + <<: *services_php54 + build: + context: .docker/php72_73 + args: + PHP_VERSION: '7.3' + + php74: + <<: *services_php54 + build: + context: .docker/php74_81 + args: + PHP_VERSION: '7.4' + + php80: + <<: *services_php54 + build: + context: .docker/php74_81 + args: + PHP_VERSION: '8.0' + + php81: + <<: *services_php54 + build: + context: .docker/php74_81 + args: + PHP_VERSION: '8.1' + + db: + image: mysql:5.5.62 + environment: + - MYSQL_ALLOW_EMPTY_PASSWORD=yes + volumes: + - db_socket:/tmp + entrypoint: + - bash + - -c + - | + { + echo "CREATE DATABASE IF NOT EXISTS test;" + } | tee /docker-entrypoint-initdb.d/init.sql + + exec /usr/local/bin/docker-entrypoint.sh mysqld diff --git a/tests/bin/test b/tests/bin/test new file mode 100755 index 000000000..20d8d6aee --- /dev/null +++ b/tests/bin/test @@ -0,0 +1,76 @@ +#! /bin/sh -eu +# +# [] [] [] +# +# example: php70 +# One of highest (default), lowest +# +# Both arguments can be a space separated value. +# Example: "lowest highest" +# + +# Configuration +# +dependencyPreferences='highest' +skipPHPVersions='php8' + +# Commands +# +dcexec="docker-compose exec -u `id -u`:`id -g`" +composerUpdate='composer update --prefer-dist --no-suggest --optimize-autoloader' +doctrineTestSuite='run.php' + +# Parse arguments +# +phpVersions="${1-}" +dependencyPreferences="${2-${dependencyPreferences}}" +phpTestRuntime="${3-${doctrineTestSuite}}" + +script () +{ + echo + echo + echo $0 ${1} ${2} + echo + ${dcexec} ${1} php ${phpTestRuntime} +} + +scriptAll () +{ + for dependencyPreference in ${dependencyPreferences} + do + install_${dependencyPreference} + + for phpVersion in ${phpVersions} + do + script ${phpVersion} ${dependencyPreference} + done + done +} + +fetchAllPHPVersions () +{ + docker-compose 2>/dev/null ps --services --filter status=running \ + | grep php \ + | sort \ + | grep -v ${skipPHPVersions} +} + +install_highest () +{ + ${dcexec} composer ${composerUpdate} +} + +install_lowest () +{ + ${dcexec} composer ${composerUpdate} --prefer-lowest +} + +echo '+ docker-compose build' +docker-compose up -d --build --remove-orphans > /dev/null + +test x"" != x"${phpVersions}" || { + phpVersions=`fetchAllPHPVersions` +} + +scriptAll