Skip to content
Snippets Groups Projects
Unverified Commit 4abc2e67 authored by Joël Sunier's avatar Joël Sunier :beer:
Browse files

ci: trying to fix CI errors

parent 2ef98417
Branches
No related tags found
No related merge requests found
......@@ -10,3 +10,7 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{yml,yaml}]
indent_style = space
indent_size = 2
......@@ -4,13 +4,19 @@ on: [push, pull_request]
jobs:
test:
name: Test Symfony bundle using PHP ${{ matrix.php-versions }}
name: Test Symfony bundle using PHP ${{ matrix.php-versions }} and ${{ matrix.dependencies }} dependencies
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0', '8.1']
php-versions:
- '7.4'
- '8.0'
- '8.1'
dependencies:
- "lowest"
- "highest"
steps:
- uses: actions/checkout@v2
......@@ -40,8 +46,11 @@ jobs:
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- uses: "ramsey/composer-install@v1"
name: Install Composer dependencies
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "${{ matrix.composer-options }}"
- name: Run Tests
run: php vendor/bin/phpunit --coverage-text
......@@ -50,4 +59,6 @@ jobs:
run: php vendor/bin/phpstan analyse --no-progress
- name: Run php-cs-fixer
env:
PHP_CS_FIXER_IGNORE_ENV: true
run: php vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --diff --dry-run
......@@ -67,7 +67,6 @@ class FlexibleRolloutStrategy implements StrategyInterface
return $currentUser->getUserIdentifier();
}
// @phpstan-ignore-next-line
return $currentUser->getUsername();
}
}
......
......@@ -43,7 +43,6 @@ class GradualRolloutUserIdStrategy implements StrategyInterface
return $currentUser->getUserIdentifier();
}
// @phpstan-ignore-next-line
return $currentUser->getUsername();
}
}
......
......@@ -31,7 +31,6 @@ class UserWithIdStrategy implements StrategyInterface
return in_array($currentUser->getUserIdentifier(), $ids, false);
}
// @phpstan-ignore-next-line
return in_array($currentUser->getUsername(), $ids, false);
}
......
......@@ -74,7 +74,6 @@ class Unleash implements UnleashInterface
if (Kernel::VERSION_ID >= 50400) {
$authenticated = $token !== null;
} else {
// @phpstan-ignore-next-line
$authenticated = $token !== null && $token->isAuthenticated();
}
......@@ -97,7 +96,6 @@ class Unleash implements UnleashInterface
]);
} else {
$event = new UnleashContextEvent([
// @phpstan-ignore-next-line
'request' => $this->requestStack->getMasterRequest(),
'user' => $user,
]);
......
......@@ -11,30 +11,6 @@ use Symfony\Component\Security\Core\User\UserInterface;
*/
class UserWithIdStrategyTest extends TestCase
{
/**
* @dataProvider usernameProvider
* @covers ::isEnabled
*/
public function testIsEnabledWithUsername(array $parameters, string $username, bool $expected): void
{
if (!method_exists(UserInterface::class, 'getUsername')) {
$this->markTestSkipped(sprintf('"%s" does not provide the "getUsername" method anymore.', UserInterface::class));
return;
}
$userMock = $this->createMock(UserInterface::class);
$userMock->method('getUsername')->willReturn($username);
$context = [
'user' => $userMock,
];
$strategy = new UserWithIdStrategy();
$this->assertEquals($expected, $strategy->isEnabled($parameters, $context));
}
/**
* @dataProvider usernameProvider
* @covers ::isEnabled
......@@ -42,7 +18,11 @@ class UserWithIdStrategyTest extends TestCase
public function testIsEnabledWithUserIdentifier(array $parameters, string $username, bool $expected): void
{
$userMock = $this->createMock(User::class);
if (method_exists(UserInterface::class, 'getUsername')) {
$userMock->method('getUsername')->willReturn($username);
} else {
$userMock->method('getUserIdentifier')->willReturn($username);
}
$context = [
'user' => $userMock,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment