Skip to content

Commit 80d31cb

Browse files
author
Hannes Giesenow
committed
Added tests
1 parent 9108100 commit 80d31cb

31 files changed

Lines changed: 539 additions & 215 deletions

.github/workflows/composer.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Composer validate
2+
3+
on:
4+
pull_request:
5+
branches: [ 'main' ]
6+
7+
jobs:
8+
phpstan:
9+
runs-on: ubuntu-latest
10+
container: ghcr.io/${{ github.repository }}/php:8.3
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Run check
14+
run: composer validate
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ name: Create and publish a Docker image
22

33
on:
44
schedule:
5-
- cron: '0 9 1 * *'
5+
- cron: '0 3 1 * *'
6+
# push:
7+
# branches:
8+
# - 'test-pipeline'
69

710
env:
811
REGISTRY: ghcr.io
@@ -14,7 +17,9 @@ jobs:
1417
permissions:
1518
contents: read
1619
packages: write
17-
20+
strategy:
21+
matrix:
22+
php_version: ['8.3','8.4','8.5']
1823
steps:
1924
- name: Checkout repository
2025
uses: actions/checkout@v3
@@ -36,7 +41,8 @@ jobs:
3641
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
3742
with:
3843
context: docker
44+
file: docker/Dockerfile.${{matrix.php_version}}
3945
push: true
4046
#tags: ${{ steps.meta.outputs.tags }}
41-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
47+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{matrix.php_version}}
4248
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/phpcsfixer.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Code Style
2+
3+
on:
4+
pull_request:
5+
branches: [ 'main' ]
6+
7+
jobs:
8+
phpcsfixer:
9+
runs-on: ubuntu-latest
10+
container:
11+
image: ghcr.io/php-cs-fixer/php-cs-fixer:3.95-php${{matrix.php_version}}
12+
strategy:
13+
matrix:
14+
php_version: ['8.3','8.4','8.5']
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Run check
18+
run: php-cs-fixer check --diff --format txt

.github/workflows/phpstan.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Static code analysis
2+
3+
on:
4+
pull_request:
5+
branches: [ 'main' ]
6+
7+
jobs:
8+
phpstan:
9+
runs-on: ubuntu-latest
10+
container: ghcr.io/${{ github.repository }}/php:${{matrix.php_version}}
11+
strategy:
12+
matrix:
13+
php_version: ['8.3','8.4','8.5']
14+
ibexa_version: ['4.6','5.0']
15+
fail-fast: false
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Update Dependencies
19+
run: composer require ibexa/experience:"${{matrix.ibexa_version}}.*"
20+
env:
21+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
22+
- name: Run code analysis
23+
run: vendor/bin/phpstan --memory-limit=-1

.github/workflows/unittest.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Run tests
2+
3+
#on:
4+
# pull_request:
5+
# branches: [ 'main' ]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}/php
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
container:
15+
image: ghcr.io/elbformat/ibexa-behat-bundle/php:${{matrix.php_version}}
16+
strategy:
17+
fail-fast: true
18+
matrix:
19+
php_version: ['8.3','8.4','8.5']
20+
ibexa_version: ['4.6','5.0']
21+
steps:
22+
# - uses: shivammathur/setup-php@2cb9b829437ee246e9b3cac53555a39208ca6d28
23+
# with:
24+
# php-version: ${{matrix.php_version}}
25+
- uses: actions/checkout@v4
26+
- name: Update Dependencies
27+
run: composer require ibexa/experience:"${{matrix.ibexa_version}}.*"
28+
env: # Or as an environment variable
29+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
30+
# - name: Install Dependencies
31+
# run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
32+
# env: # Or as an environment variable
33+
# COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
34+
- name: Run test
35+
run: vendor/bin/phpunit

.php-cs-fixer.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
$config = new PhpCsFixer\Config();
4+
$config->setRules([
5+
'@Symfony' => true,
6+
'@Symfony:risky' => true,
7+
'declare_strict_types' => true,
8+
'strict_comparison' => true,
9+
'modernize_types_casting' => true
10+
]);
11+
$config->setRiskyAllowed(true);
12+
$config->setFinder(
13+
PhpCsFixer\Finder::create()
14+
->in(__DIR__ . DIRECTORY_SEPARATOR . 'src')
15+
->files()->name('*.php')
16+
);
17+
18+
return $config;
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
version: '2.1'
21
services:
32
mysql:
4-
image: mariadb:10.6
3+
image: mariadb:12.3
54
environment:
65
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PW:-root}"
76
MYSQL_DATABASE: "test"
@@ -12,11 +11,11 @@ services:
1211
# TODO: add solr
1312

1413
php:
15-
image: ghcr.io/elbformat/ibexa-behat-bundle/php
14+
image: ghcr.io/elbformat/ibexa-behat-bundle/php:8.5
1615
environment:
1716
DATABASE_URL: 'mysql://test:test@mysql:3306/test'
18-
1917
depends_on:
2018
- mysql
19+
working_dir: /var/www
2120
volumes:
2221
- ./:/var/www

composer.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "elbformat/ibexa-behat-bundle",
3+
"version": "2.3.0",
34
"description": "Context and Helpers to integrate behat tests in your ibexa dxp installation.",
45
"type": "symfony-bundle",
56
"license": "MIT",
@@ -16,28 +17,29 @@
1617
],
1718
"autoload": {
1819
"psr-4": {
19-
"Elbformat\\IbexaBehatBundle\\": "src/"
20+
"Elbformat\\IbexaBehatBundle\\": "src/",
21+
"Test\\": "tests/"
2022
}
2123
},
2224
"require": {
23-
"php": ">=8.1",
25+
"php": ">=8.3",
2426
"elbformat/field-helper-bundle": "^2.0",
2527
"elbformat/symfony-behat-bundle": "^1.5",
26-
"ibexa/experience": "^4.6|5.0.*"
28+
"ibexa/experience": "^4.6 | ^5.0.0"
2729
},
2830
"require-dev": {
2931
"dvdoug/behat-code-coverage": "^5.2",
30-
"netgen/tagsbundle": "^5.0",
32+
"phpstan/phpstan": "^2.2",
3133
"phpunit/phpunit": "^9.5"
3234
},
3335
"config": {
3436
"sort-packages": true,
3537
"allow-plugins": {
36-
"symfony/runtime": true,
3738
"composer/package-versions-deprecated": true,
39+
"ibexa/post-install": true,
3840
"php-http/discovery": false,
3941
"symfony/flex": true,
40-
"ibexa/post-install": true
42+
"symfony/runtime": true
4143
}
4244
},
4345
"repositories": {

doc/development.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@ export XDEBUG_MODE="debug"
1414
Run tests
1515
```bash
1616
vendor/bin/phpunit
17+
```
18+
19+
Fix code styles
20+
```bash
21+
docker run -v "$(pwd):/code" --rm ghcr.io/php-cs-fixer/php-cs-fixer:3.95-php8.3 fix --diff src
1722
```

docker/Dockerfile

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)