Skip to content

Commit 33320f7

Browse files
[Maintenance] Modernize dependencies and cleanup
1 parent c6930ed commit 33320f7

14 files changed

Lines changed: 233 additions & 45 deletions

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/features export-ignore
2+
/.github export-ignore
23

34
/.gitattributes export-ignore
45
/.gitignore export-ignore
5-
/.travis.yml export-ignore
66
/behat.yml.dist export-ignore
7+
/behat.dist.php export-ignore

.github/workflows/build.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,34 @@ on:
66
release:
77
types: [created]
88
schedule:
9-
-
10-
cron: "0 1 * * 6" # Run at 1am every Saturday
9+
- cron: "0 1 * * 6" # Run at 1am every Saturday
1110

1211
jobs:
1312
tests:
14-
runs-on: ubuntu-20.04
15-
name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}"
13+
runs-on: ubuntu-latest
14+
name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, Behat ${{ matrix.behat }}, ${{ matrix.dependencies }} deps"
1615
strategy:
1716
fail-fast: false
1817
matrix:
1918
php: ["8.1", "8.2", "8.3"]
20-
symfony: ["^5.4", "^6.4", "7.0"]
19+
symfony: ["^5.4", "^6.4", "^7.4"]
20+
behat: ["^3.8"]
21+
dependencies: ["lowest", "highest"]
2122
exclude:
22-
- php: "8.1"
23-
symfony: "7.0"
23+
- symfony: "^7.4"
24+
php: "8.1"
25+
include:
26+
- php: "8.3"
27+
symfony: "^7.4"
28+
behat: "4.x-dev"
29+
dependencies: "highest"
30+
- php: "8.4"
31+
symfony: "^8.0"
32+
behat: "4.x-dev"
33+
dependencies: "highest"
2434

2535
steps:
26-
- uses: actions/checkout@v2
36+
- uses: actions/checkout@v6
2737

2838
- name: Setup PHP
2939
uses: shivammathur/setup-php@v2
@@ -34,14 +44,20 @@ jobs:
3444
- name: Restrict Symfony version
3545
if: matrix.symfony != ''
3646
run: |
47+
composer global require --no-progress --no-scripts --no-plugins "symfony/flex"
3748
composer global config --no-plugins allow-plugins.symfony/flex true
38-
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.11"
3949
composer config extra.symfony.require "${{ matrix.symfony }}"
50+
composer config minimum-stability "dev"
51+
composer config prefer-stable true
52+
53+
- name: Restrict Behat version
54+
run: composer require --no-update "behat/behat:${{ matrix.behat }}"
4055

4156
- name: Install dependencies
42-
run: composer update
57+
run: composer update ${{ matrix.dependencies == 'lowest' && '--prefer-lowest --prefer-stable' || '' }}
4358

4459
- name: Run analysis
60+
if: matrix.behat != '4.x-dev'
4561
run: composer validate --strict
4662

4763
- name: Run tests

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016-2021 Łukasz Chruściel
1+
Copyright (c) 2016-present Łukasz Chruściel
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

behat.dist.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Behat\Config\Config;
6+
use Behat\Config\Profile;
7+
use Behat\Config\Suite;
8+
use FriendsOfBehat\TestContext\Context\TestContext;
9+
10+
return (new Config())
11+
->withProfile(
12+
(new Profile('default'))
13+
->withSuite(
14+
(new Suite('default'))
15+
->withPaths(__DIR__ . '/features/attributes')
16+
->withContexts(TestContext::class)
17+
)
18+
);

behat.yml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
default:
22
suites:
33
default:
4+
paths:
5+
- '%paths.base%/features/annotations'
46
contexts:
57
- FriendsOfBehat\TestContext\Context\TestContext

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
],
1111
"require": {
1212
"php": "^8.1",
13-
"behat/behat": "^3.8",
14-
"symfony/dependency-injection": "^5.4 || ^6.4 || ^7.0"
13+
"behat/behat": "^3.8 || ^4.0",
14+
"symfony/dependency-injection": "^5.4 || ^6.4 || ^7.4 || ^8.0"
1515
},
1616
"require-dev": {
17-
"friends-of-behat/test-context": "^1.0"
17+
"friends-of-behat/test-context": "^1.4"
1818
},
1919
"extra": {
2020
"branch-alias": {

features/transforming_variadic_arguments_in_step_definitions.feature renamed to features/annotations/transforming_variadic_arguments_in_step_definitions.feature

File renamed without changes.

features/using_variadic_arguments_in_steps_definitions_with_named_parameters.feature renamed to features/annotations/using_variadic_arguments_in_steps_definitions_with_named_parameters.feature

File renamed without changes.

features/using_variadic_arguments_in_steps_definitions_with_not_named_parameters.feature renamed to features/annotations/using_variadic_arguments_in_steps_definitions_with_not_named_parameters.feature

File renamed without changes.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Feature: Transforming variadic arguments in step definitions
2+
In order to make Behat steps definitions cleaner and more readable
3+
As a Behat User
4+
I want to have transformed variadic arguments in these
5+
6+
Background:
7+
Given a Behat configuration containing:
8+
"""
9+
default:
10+
extensions:
11+
FriendsOfBehat\VariadicExtension: ~
12+
"""
13+
And a context file "features/bootstrap/FeatureContext.php" containing:
14+
"""
15+
<?php
16+
17+
use Behat\Behat\Context\Context;
18+
use Behat\Hook\BeforeScenario;
19+
use Behat\Step\When;
20+
use Behat\Transformation\Transform;
21+
22+
class FeatureContext implements Context
23+
{
24+
#[Transform('/^(\w+)$/')]
25+
public function transform($string)
26+
{
27+
return strtoupper($string);
28+
}
29+
30+
#[When('/^I pass "(\w+)" and "(\w+)" as arguments$/')]
31+
#[When('I pass :firstArgument, :secondArgument and :thirdArgument')]
32+
public function iPass(...$arguments)
33+
{
34+
printf('Arguments: %s', join(', ', $arguments));
35+
}
36+
}
37+
"""
38+
39+
Scenario: Transforming variadic arguments in step definitions with a regex
40+
Given a feature file "features/variadic_arguments_support.feature" containing:
41+
"""
42+
Feature: Transforming variadic arguments in step definitions
43+
44+
Scenario: Transforming variadic arguments in step definitions
45+
When I pass "foo" and "bar" as arguments
46+
"""
47+
When I run Behat
48+
Then it should pass with "Arguments: FOO, BAR"
49+
50+
Scenario: Transforming variadic arguments in step definitions without regex
51+
Given a feature file "features/variadic_arguments_support.feature" containing:
52+
"""
53+
Feature: Transforming variadic arguments in step definitions
54+
55+
Scenario: Transforming variadic arguments in step definitions
56+
When I pass "one", "two" and "three"
57+
"""
58+
When I run Behat
59+
Then it should pass with "Arguments: ONE, TWO, THREE"

0 commit comments

Comments
 (0)