Skip to content

Commit 4ce8a28

Browse files
authored
Merge pull request #819 from stof/drop_old_versions
Drop support for PHP <7.2 and old Symfony versions
2 parents a91ab98 + 00bd801 commit 4ce8a28

13 files changed

Lines changed: 25 additions & 78 deletions

.github/workflows/tests.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ jobs:
1212

1313
tests:
1414
name: Tests
15-
runs-on: Ubuntu-20.04
15+
runs-on: ubuntu-20.04
1616

1717
strategy:
1818
matrix:
19-
php: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
19+
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
2020
composer_flags: [ '' ]
2121
minimum_stability: [ '' ]
2222
symfony_deprecations_helper: [ '' ]
2323
include:
24-
- php: '7.1'
24+
- php: '7.2'
2525
composer_flags: '--prefer-lowest --prefer-stable'
2626
symfony_deprecations_helper: weak
2727
- php: '8.0'
@@ -48,11 +48,6 @@ jobs:
4848
run: |
4949
composer config minimum-stability dev
5050
51-
- name: Configure for PHP >= 7.1
52-
if: "${{ matrix.php >= '7.1' }}"
53-
run: |
54-
composer require --no-update --dev symfony/error-handler "^4.4 || ^5.0"
55-
5651
- name: Install dependencies
5752
run: |
5853
composer update ${{ matrix.composer_flags }}

composer.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,18 @@
1515
],
1616

1717
"require": {
18-
"php": ">=5.4",
19-
"symfony/css-selector": "^2.7|^3.0|^4.0|^5.0|^6.0"
18+
"php": ">=7.2",
19+
"symfony/css-selector": "^4.4 || ^5.0 || ^6.0"
2020
},
2121

2222
"require-dev": {
23-
"symfony/debug": "^2.7|^3.0|^4.0|^5.0|^6.0",
24-
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5 || ^9.5",
25-
"symfony/phpunit-bridge": "^3.4.38 || ^4.4 || ^5.0.5 || ^6.0",
26-
"yoast/phpunit-polyfills": "^1.0"
23+
"symfony/error-handler": "^4.4 || ^5.0 || ^6.0",
24+
"phpunit/phpunit": "^8.5.22 || ^9.5.11",
25+
"symfony/phpunit-bridge": "^5.4 || ^6.0"
2726
},
2827

2928
"suggest": {
30-
"behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)",
31-
"behat/mink-goutte-driver": "fast headless driver for any app without JS emulation",
29+
"behat/mink-browserkit-driver": "fast headless driver for any app without JS emulation",
3230
"behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)",
3331
"dmore/chrome-mink-driver": "fast and JS-enabled driver for any app (requires chromium or google chrome)",
3432
"behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)"

src/Selector/CssSelector.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
namespace Behat\Mink\Selector;
1212

13-
use Symfony\Component\CssSelector\CssSelector as CSS;
1413
use Symfony\Component\CssSelector\CssSelectorConverter;
1514

1615
/**
@@ -33,14 +32,8 @@ public function translateToXPath($locator)
3332
throw new \InvalidArgumentException('The CssSelector expects to get a string as locator');
3433
}
3534

36-
// Symfony 2.8+ API
37-
if (class_exists('Symfony\Component\CssSelector\CssSelectorConverter')) {
38-
$converter = new CssSelectorConverter();
35+
$converter = new CssSelectorConverter();
3936

40-
return $converter->toXPath($locator);
41-
}
42-
43-
// old static API for Symfony 2.7 and older
44-
return CSS::toXPath($locator);
37+
return $converter->toXPath($locator);
4538
}
4639
}

tests/Driver/CoreDriverTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,9 @@
44

55
use Behat\Mink\Element\NodeElement;
66
use PHPUnit\Framework\TestCase;
7-
use Yoast\PHPUnitPolyfills\Polyfills\AssertIsType;
8-
use Yoast\PHPUnitPolyfills\Polyfills\ExpectException;
97

108
class CoreDriverTest extends TestCase
119
{
12-
use ExpectException;
13-
use AssertIsType;
14-
1510
public function testNoExtraMethods()
1611
{
1712
$interfaceRef = new \ReflectionClass('Behat\Mink\Driver\DriverInterface');

tests/Element/DocumentElementTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
namespace Behat\Mink\Tests\Element;
44

55
use Behat\Mink\Element\DocumentElement;
6-
use Yoast\PHPUnitPolyfills\Polyfills\ExpectException;
76

87
class DocumentElementTest extends ElementTest
98
{
10-
use ExpectException;
11-
129
/**
1310
* Page.
1411
*

tests/Element/ElementTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Behat\Mink\Driver\DriverInterface;
66
use Behat\Mink\Session;
77
use Behat\Mink\Selector\SelectorsHandler;
8+
use PHPUnit\Framework\MockObject\MockObject;
89
use PHPUnit\Framework\TestCase;
910

1011
abstract class ElementTest extends TestCase
@@ -17,14 +18,14 @@ abstract class ElementTest extends TestCase
1718
protected $session;
1819

1920
/**
20-
* @var DriverInterface|\PHPUnit_Framework_MockObject_MockObject
21+
* @var DriverInterface&MockObject
2122
*/
2223
protected $driver;
2324

2425
/**
2526
* Selectors.
2627
*
27-
* @var SelectorsHandler|\PHPUnit_Framework_MockObject_MockObject
28+
* @var SelectorsHandler&MockObject
2829
*/
2930
protected $selectors;
3031

tests/Element/NodeElementTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
namespace Behat\Mink\Tests\Element;
44

55
use Behat\Mink\Element\NodeElement;
6-
use Yoast\PHPUnitPolyfills\Polyfills\ExpectException;
76

87
class NodeElementTest extends ElementTest
98
{
10-
use ExpectException;
11-
129
public function testGetXpath()
1310
{
1411
$node = new NodeElement('some custom xpath', $this->session);

tests/MinkTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44

55
use Behat\Mink\Mink;
66
use PHPUnit\Framework\TestCase;
7-
use Yoast\PHPUnitPolyfills\Polyfills\ExpectException;
87

98
class MinkTest extends TestCase
109
{
11-
use ExpectException;
12-
1310
/**
1411
* @var Mink
1512
*/

tests/Selector/CssSelectorTest.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,17 @@
44

55
use Behat\Mink\Selector\CssSelector;
66
use PHPUnit\Framework\TestCase;
7-
use Yoast\PHPUnitPolyfills\Polyfills\ExpectException;
87

98
class CssSelectorTest extends TestCase
109
{
11-
use ExpectException;
12-
1310
public function testSelector()
1411
{
1512
$selector = new CssSelector();
1613

1714
$this->assertEquals('descendant-or-self::h3', $selector->translateToXPath('h3'));
1815
$this->assertEquals('descendant-or-self::h3/span', $selector->translateToXPath('h3 > span'));
1916

20-
if (interface_exists('Symfony\Component\CssSelector\XPath\TranslatorInterface')) {
21-
// The rewritten component of Symfony 2.3 checks for attribute existence first for the class.
22-
$expectation = "descendant-or-self::h3/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' my_div ')]";
23-
} else {
24-
$expectation = "descendant-or-self::h3/*[contains(concat(' ', normalize-space(@class), ' '), ' my_div ')]";
25-
}
17+
$expectation = "descendant-or-self::h3/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' my_div ')]";
2618
$this->assertEquals($expectation, $selector->translateToXPath('h3 > .my_div'));
2719
}
2820

tests/Selector/NamedSelectorTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@
55
use Behat\Mink\Selector\NamedSelector;
66
use Behat\Mink\Selector\Xpath\Escaper;
77
use PHPUnit\Framework\TestCase;
8-
use Yoast\PHPUnitPolyfills\Polyfills\ExpectException;
98

109
abstract class NamedSelectorTest extends TestCase
1110
{
12-
use ExpectException;
13-
1411
public function testRegisterXpath()
1512
{
1613
$selector = $this->getSelector();

0 commit comments

Comments
 (0)