Skip to content

FEATURE: Add unit and functional tests #141

FEATURE: Add unit and functional tests

FEATURE: Add unit and functional tests #141

Workflow file for this run

name: build
on:
push:
branches:
- 'main'
pull_request: ~
jobs:
test:
name: "Test (PHP ${{ matrix.php-versions }}, Neos ${{ matrix.neos-versions }})"
strategy:
fail-fast: false
matrix:
php-versions: [ '7.4' ]
neos-versions: [ '7.3' ]
include:
- php-versions: '8.1'
neos-versions: '8.3'
runs-on: ubuntu-latest
env:
FLOW_CONTEXT: Testing
DIST_FOLDER: DistributionPackages/Sitegeist.LostInTranslation
steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: ${{ env.DIST_FOLDER }}
# - name: Setup PHP
# uses: shivammathur/setup-php@v2
# with:
# php-version: ${{ matrix.php-versions }}
# extensions: mbstring, xml, json, zlib, iconv, intl, pdo_sqlite, mysql, pgsql, redis, memcached, memcache, apcu
# ini-values: date.timezone="Africa/Tunis", opcache.fast_shutdown=0, apc.enable_cli=on
#
# - name: Set Neos Version
# run: composer require neos/neos ^${{ matrix.neos-versions }} --no-progress --no-interaction
#
# - name: Run Tests
# run: composer test
# Copied from Neos Development Collection
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, json, zlib, iconv, intl, pdo_sqlite, mysql, pgsql, redis, memcached, memcache, apcu
ini-values: date.timezone="Africa/Tunis", opcache.fast_shutdown=0, apc.enable_cli=on
- name: Install Neos Project and other dependencies
run: |
composer create --no-scripts neos/neos-base-distribution ${{ matrix.neos-versions }}
composer require fakerphp/faker "^1.23.0"
composer config repositories.lostintranslation '{ "type": "path", "url": "../${{ env.DIST_FOLDER }}", "options": { "symlink": false } }'
composer require sitegeist/lostintranslation "@dev"
composer install
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: |
~/.cache/composer
~/Packages
key: php-${{ matrix.php-versions }}-${{ matrix.dependencies }}${{ hashFiles('**/composer.json') }}
restore-keys: php-${{ matrix.php-versions }}-${{ matrix.dependencies }}
- name: Install dependencies
run: |
composer ${{ matrix.dependencies == 'locked' && 'install' || 'update' }} --no-progress --no-interaction ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }} ${{ matrix.composer-arguments }}
- name: Set Flow Context
run: echo "FLOW_CONTEXT=${{ env.FLOW_CONTEXT }}" >> $GITHUB_ENV
# - name: Setup Flow configuration
# run: |
# rm -f Configuration/Routes.yaml
# rm -f Configuration/Testing/Settings.yaml
# cat <<EOF >> Configuration/Testing/Settings.yaml
# Neos:
# Flow:
# persistence:
# backendOptions:
# host: '127.0.0.1'
# driver: pdo_mysql
# user: 'neos'
# password: 'neos'
# dbname: 'flow_functional_testing'
# ContentRepositoryRegistry:
# postgres:
# persistence:
# backendOptions:
# host: '127.0.0.1'
# port: 5432
# driver: pdo_pgsql
# dbname: 'flow_functional_testing'
# user: 'neos'
# password: 'neos'
# charset: 'UTF8'
#
# # We enable the race condition tracker
# presets:
# 'default':
# projections:
# 'Neos.ContentRepository:ContentGraph':
# catchUpHooks:
# 'Neos.ContentRepository.BehavioralTests:RaceConditionTracker':
# factoryObjectName: Neos\ContentRepository\BehavioralTests\ProjectionRaceConditionTester\RaceTrackerCatchUpHookFactory
# ContentRepository:
# BehavioralTests:
# raceConditionTracker:
# enabled: true
# redis:
# host: 127.0.0.1
# port: 6379
#
# EOF
# mkdir Configuration/Testing/Postgres
# cat <<EOF >> Configuration/Testing/Postgres/Settings.yaml
# Neos:
# Flow:
# persistence:
# backendOptions:
# host: '127.0.0.1'
# port: 5432
# driver: pdo_pgsql
# charset: 'UTF8'
# user: 'neos'
# password: 'neos'
# dbname: 'flow_functional_testing'
# EOF
# echo "Running in context '$FLOW_CONTEXT'"
# # Enable for debugging: ./flow configuration:show
# # Enable for debugging: ./flow routing:list
# - name: Run Linter
# if: matrix.parallel-parts == 'linting-unit-functionaltests-mysql'
# run: |
# cd Packages/Neos
# composer lint
#
# - name: Run unit tests
# run: bin/phpunit --colors -c Build/BuildEssentials/PhpUnit/UnitTests.xml --verbose
- name: Run functional tests
run: |
bin/phpunit --colors --stop-on-failure -c DistributionPackages/Sitegeist.LostInTranslation/Tests/FunctionalTests.xml --testsuite "LostInTranslation" --verbose