Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 54 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,41 @@ on:
- 'main'
- 'hotfix-*'

permissions:
contents: read

concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
static-checks:
name: Run static checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"

- name: Validate composer.json
run: composer validate

- name: Install dependencies
run: composer update --prefer-dist --no-progress

- name: Run PHP_CodeSniffer
run: vendor/bin/phpcs -sp

- name: Run Psalm
run: vendor/bin/psalm --shepherd

tests:
name: PHP ${{ matrix.php-version }} on ${{ matrix.os }} (${{ matrix.composer-options }})
runs-on: ${{ matrix.os }}
name: Test on ${{ matrix.os }} php${{ matrix.php-version }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
Expand All @@ -22,15 +53,13 @@ jobs:
- "8.2"
- "8.3"
os:
- ubuntu-latest
- windows-latest
- macOS-latest
composer-options:
- ""
- "--prefer-lowest"
- ubuntu
- windows
- macOS

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
Expand All @@ -40,14 +69,21 @@ jobs:
coverage: xdebug
ini-values: error_reporting=E_ALL

- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies
run: composer update
--prefer-dist
--no-progress
${{ matrix.composer-options }}
run: composer update --prefer-dist --no-progress

- name: Show Codeception version
run: |
echo "Tested against Codeception **v$(
composer show codeception/codeception --format json | jq -r '.versions[0]'
)**" >> "$GITHUB_STEP_SUMMARY"
shell: bash

- name: Run unit tests tests
run: composer test-unit

- name: Run samples
run: composer test-report-generate

- name: Run tests
run: composer test
- name: Assert samples
run: composer test-report-check
5 changes: 4 additions & 1 deletion .github/workflows/labels-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]

permissions:
contents: read

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: baev/match-label-action@master
with:
allowed: 'type:bug,type:new feature,type:improvement,type:dependencies,type:internal,type:invalid'
allowed: 'type:bug,type:new feature,type:improvement,type:dependencies,type:internal,type:invalid,type:docs'
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
"allure-framework/allure-php-commons": "^2.3.1"
},
"require-dev": {
"psalm/plugin-phpunit": "^0.19.0",
"psalm/plugin-phpunit": "^0.19.0 || ^0.20.1",
"remorhaz/php-json-data": "^0.5.3",
"remorhaz/php-json-path": "^0.7.7",
"squizlabs/php_codesniffer": "^3.7.2",
"vimeo/psalm": "^5.12"
"squizlabs/php_codesniffer": "^4.0.1",
"vimeo/psalm": "^5.26.1 || ^6.16.1"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

<file>src</file>
<file>test</file>
<exclude-pattern>test/codeception/_support/_generated/*</exclude-pattern>
<exclude-pattern>test/codeception-report/_support/_generated/*</exclude-pattern>

<arg name="colors"/>

Expand Down
4 changes: 2 additions & 2 deletions src/Internal/GherkinProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public function getLabels(): array
return array_map(
fn (string $value) => Label::feature($value),
[
...array_values($this->test->getFeatureNode()->getTags()),
...array_values($this->test->getScenarioNode()->getTags()),
...$this->test->getFeatureNode()->getTags(),
...$this->test->getScenarioNode()->getTags(),
],
);
}
Expand Down
7 changes: 6 additions & 1 deletion src/Internal/UnitInfoBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ public function build(?string $host, ?string $thread): TestInfo
$index = $this->test->getMetadata()->getIndex();
$dataLabel = is_int($index) ? "#$index" : $index;

/**
* @var null|string
*/
$class = $fields['class'];

return new TestInfo(
originalTest: $this->test,
signature: $this->test->getSignature(),
class: $fields['class'] ?? null,
class: $class ?? null,
method: $this->test->getMetadata()->getName(),
dataLabel: $dataLabel,
host: $host,
Expand Down
3 changes: 3 additions & 0 deletions test/codeception-report/unit/StepsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ private function createFailingStep(string $name, string $failure): Step
return new class ($failure, $name) extends Meta {
private string $failure;

/**
* @param array<array-key, string> $arguments
*/
public function __construct(string $failure, string $action, array $arguments = [])
{
parent::__construct($action, $arguments);
Expand Down
Loading