Skip to content

Commit d2d258b

Browse files
committed
Add composer.json based test
1 parent 2ab3331 commit d2d258b

5 files changed

Lines changed: 105 additions & 0 deletions

File tree

.github/workflows/e2e-tests.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
name: "E2E Tests"
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- "2.0.x"
10+
11+
concurrency:
12+
group: e2e-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
e2e-tests:
20+
name: "E2E tests"
21+
runs-on: "ubuntu-latest"
22+
timeout-minutes: 60
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
include:
28+
- script: |
29+
cd e2e/composer-version
30+
composer install
31+
vendor/bin/phpstan
32+
33+
steps:
34+
- name: Harden the runner (Audit all outbound calls)
35+
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
36+
with:
37+
egress-policy: audit
38+
39+
- name: "Checkout"
40+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
41+
42+
- name: "Install PHP"
43+
uses: "shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc" # v2.37.1
44+
with:
45+
coverage: "none"
46+
php-version: "8.3"
47+
48+
- uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v4.0.0
49+
50+
- name: "Install bashunit"
51+
uses: "TypedDevs/bashunit@ffa9c79e71ecbb9990e777348bc9ba12314b62d0" # 0.39.1
52+
with:
53+
directory: "e2e"
54+
55+
- name: "Test"
56+
run: ${{ matrix.script }}

e2e/composer-version/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor
2+
composer.lock

e2e/composer-version/composer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"require": {
3+
"php": "^8.1",
4+
"phpstan/phpstan": "@dev",
5+
"phpstan/phpstan-phpunit": "@dev"
6+
},
7+
"repositories": [
8+
{
9+
"type": "path",
10+
"url": "../../"
11+
}
12+
],
13+
"require-dev": {
14+
"phpunit/phpunit": "^12.5",
15+
"phpstan/extension-installer": "^1.4"
16+
},
17+
"config": {
18+
"allow-plugins": {
19+
"phpstan/extension-installer": true
20+
}
21+
}
22+
}

e2e/composer-version/phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
includes:
2+
- phar://phpstan.phar/conf/bleedingEdge.neon

e2e/composer-version/test.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
use PHPUnit\Framework\Attributes\RequiresPhp;
4+
5+
class A extends \PHPUnit\Framework\TestCase {
6+
#[RequiresPhp('<=8.2.0')]
7+
public function testFoo() {}
8+
}
9+
10+
class B extends \PHPUnit\Framework\TestCase {
11+
#[RequiresPhp('<=8.0.0')]
12+
public function testFoo() {}
13+
}
14+
15+
class C extends \PHPUnit\Framework\TestCase {
16+
#[RequiresPhp('^8.0.0')]
17+
public function testFoo() {}
18+
}
19+
20+
class D extends \PHPUnit\Framework\TestCase {
21+
#[RequiresPhp('^8.1.0')]
22+
public function testFoo() {}
23+
}

0 commit comments

Comments
 (0)