version: "3"

services:
  tests:
    build:
      context: "./bin"
      args:
        PHP_VERSION: "${PHP_VERSION:-7.2}"
    depends_on:
      - wpgraphql_test
    environment:
      DB_SERVE_NAME: "wpgraphql_test"
    networks:
      - "testing"
    volumes:
      - "test-suite:/tmp"
      - "./:/project"
  wpgraphql_test:
    image: "wordpress:${WP_VERSION:-4.9.4}-php${PHP_VERSION:-7.2}-apache"
    depends_on:
      - mysql_test
    environment:
      WORDPRESS_DB_HOST: "mysql_test"
      WORDPRESS_DB_NAME: "wpgraphql_test"
      WORDPRESS_DB_PASSWORD: "testing"
      WORDPRESS_DB_USER: "root"
    networks:
      testing:
        aliases:
          - "wpgraphql.test"
    volumes:
      - "./:/var/www/html/wp-content/plugins/wp-graphql"
  mysql_test:
    image: "mariadb:10.2"
    environment:
      MYSQL_DATABASE: "wpgraphql_test"
      MYSQL_ROOT_PASSWORD: "testing"
    networks:
      - "testing"

networks:
  testing: {}

volumes:
  test-suite: {}
