Commit 98c7132a authored by GridexX's avatar GridexX
Browse files

feat(phpunit_test): use official docker image



Signed-off-by: default avatarGridexX <arsene582@gmail.com>
parent b6631e5e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
# Changelog
All notable changes to this job will be documented in this file.

## [1.2.0] - 2023-04-03
* Change docker image to `bitnami/laravel`
* Add `PHPUNIT_VERSION` variable

## [1.1.1] - 2023-02-28
* Fix broken documentation links

+2 −1
Original line number Diff line number Diff line
@@ -21,8 +21,9 @@ Using this job you'll be able to launch PHPUnit tests.
| `PHPUNIT_COLORS` | Use colors in output | `never` |
| `PHPUNIT_OPTIONS` | Custom user options for phpunit | ` ` |
| `PHPUNIT_MEMORY_LIMIT` | Memory available for PHPUnit (see [more](#php-memory-limit)) | `512M` |
| `PHPUNIT_VERSION` | PHPUnit version to install | `10.0.19` |
| `PROJECT_ROOT` | PHP Project location | `/` |
| `IMAGE_TAG` | The default tag for the docker image | `7.3`  |
| `IMAGE_TAG` | The default tag for the docker image | `9.5.2`  |

!!! note
    All paths defined in variables are starting from the root of your repository.
+8 −7
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ stages:
  - tests

phpunit_test:
  image: lorisleiva/laravel-docker:${IMAGE_TAG}
  image: bitnami/laravel:${IMAGE_TAG}
  stage: tests
  variables:
    PHPUNIT_OUTPUT: "report_phpunit.xml"
@@ -12,15 +12,16 @@ phpunit_test:
    PHPUNIT_COLORS: "never"
    PHPUNIT_OPTIONS: ""
    PHPUNIT_MEMORY_LIMIT: "512M"
    PROJECT_ROOT: "/"
    IMAGE_TAG: "7.3"
    PHPUNIT_VERSION: "10.0.19"
    PROJECT_ROOT: "."
    IMAGE_TAG: "9.5.2"
  script:
    # Installing globally PHPUnit if not already
    - composer global require "phpunit/phpunit"
    # Install phpunit for the project
    - composer require --dev "phpunit/phpunit:${PHPUNIT_VERSION}"
    # Going to the root of php project
    - cd ${CI_PROJECT_DIR}${PROJECT_ROOT}
    - cd ${CI_PROJECT_DIR}/${PROJECT_ROOT}
    # Running Unit testing
    - phpunit \
    - vendor/bin/phpunit \
      -d memory_limit=${PHPUNIT_MEMORY_LIMIT} --configuration ${PHPUNIT_CONFIG_FILE} \
      --coverage-text --colors=${PHPUNIT_COLORS} \
      --log-junit ${CI_PROJECT_DIR}/${PHPUNIT_OUTPUT} ${PHPUNIT_OPTIONS}