Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf22cb7

Browse files
committed
feature EasyCorp#4839 Test lowest dependencies; downgrade SecurityVoter::supports(); Symfony 4.4 fixes (michaelKaefer)
This PR was merged into the 3.0.x-dev branch. Discussion ---------- Test lowest dependencies; downgrade SecurityVoter::supports(); Symfony 4.4 fixes Would close EasyCorp#4382. Important Notes: - I had to downgrade `SecurityVoter::supports()` signature again which was just upgraded these days because otherwise `symfony/security-core` would be required in 5.0 or higher (which makes it impossible to install EA in symfony 4). I hope this is not a problem.. At least all tests still suceed, so I hope it is OK.. Notes: - `symfony/phpunit-bridge` v5.2 or higher is now required because we use `PolyfillAssertTrait::assertMatchesRegularExpression()` in our tests (was added in 5.2, in symfony/phpunit-bridge@f00fa7b) - `doctrine/dbal` now conflicts with versions <2.10 because we use `Doctrine\DBAL\Types\Types` in lots of places (was introducd in 2.10 in doctrine/dbal@4d40444, see also https://github.com/doctrine/dbal/blob/3.2.x/UPGRADE.md#deprecated-type-constants) - PHP's `fn()` was introduced in PHP7.4 but we use PHP7.2, so I removed all occurences Commits ------- 95840c2 GitHub action to test lowest supported dependencies, downgrade SecurityVoter::supports() signature and remove fn() (was introduced in PHP7.4)
2 parents 68a8161 + 95840c2 commit cf22cb7

4 files changed

Lines changed: 51 additions & 9 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# OS: Linux; Symfony: lowest supported by this bundle; PHP: lowest supported by this bundle
2+
name: "Tests - Lowest supported dependencies"
3+
4+
on:
5+
pull_request:
6+
push:
7+
branches:
8+
- 'master'
9+
10+
env:
11+
fail-fast: true
12+
13+
jobs:
14+
tests:
15+
runs-on: 'ubuntu-latest'
16+
continue-on-error: false
17+
steps:
18+
- name: 'Checkout code'
19+
uses: actions/[email protected]
20+
21+
- name: 'Install PHP with extensions'
22+
uses: shivammathur/[email protected]
23+
with:
24+
coverage: none
25+
php-version: '7.2.5'
26+
tools: composer:v2
27+
extensions: mbstring, intl, pdo, pdo_sqlite, sqlite3
28+
ini-values: date.timezone=UTC
29+
30+
- name: 'Install project dependencies'
31+
run: |
32+
composer global require --no-progress --no-scripts --no-plugins symfony/flex
33+
composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable --prefer-lowest
34+
vendor/bin/simple-phpunit install
35+
36+
- name: 'Run tests'
37+
env:
38+
SYMFONY_DEPRECATIONS_HELPER: 'max[indirect]=10&max[total]=27'
39+
run: vendor/bin/simple-phpunit -v

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
"symfony/browser-kit": "^4.4|^5.0|^6.0",
4545
"symfony/css-selector": "^4.4|^5.0|^6.0",
4646
"symfony/dom-crawler": "^4.4|^5.0|^6.0",
47-
"symfony/phpunit-bridge": "^4.4|^5.0|^6.0"
47+
"symfony/phpunit-bridge": "^5.2|^6.0"
4848
},
4949
"conflict": {
50-
"doctrine/dbal": ">=3.0.0"
50+
"doctrine/dbal": "<2.10 || >=3.0.0"
5151
},
5252
"config": {
5353
"sort-packages": true

src/Security/SecurityVoter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ public function __construct(AuthorizationCheckerInterface $authorizationChecker,
2727
$this->adminContextProvider = $adminContextProvider;
2828
}
2929

30-
protected function supports(string $permissionName, $subject): bool
30+
/**
31+
* @return bool
32+
*/
33+
protected function supports($permissionName, $subject)
3134
{
3235
return Permission::exists($permissionName);
3336
}

tests/Dto/CrudDtoTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ public function provideLabels()
3939
yield ['Foo Bar', 'Foo Bar'];
4040
// see https://github.com/EasyCorp/EasyAdminBundle/issues/4176
4141
yield ['link', 'link'];
42-
yield [fn () => null, null];
43-
yield [fn () => '', ''];
44-
yield [fn () => 'foo', 'foo'];
45-
yield [fn () => 'Foo Bar', 'Foo Bar'];
46-
yield [fn () => 'link', 'link'];
47-
yield [fn ($entityInstance) => 'Entity #'.$entityInstance->getPrimaryKeyValue(), 'Entity #42'];
42+
yield [function () { return null; }, null];
43+
yield [function () { return ''; }, ''];
44+
yield [function () { return 'foo'; }, 'foo'];
45+
yield [function () { return 'Foo Bar'; }, 'Foo Bar'];
46+
yield [function () { return 'link'; }, 'link'];
47+
yield [function ($entityInstance) { return 'Entity #'.$entityInstance->getPrimaryKeyValue(); }, 'Entity #42'];
4848
}
4949
}

0 commit comments

Comments
 (0)