Skip to content

Commit

Permalink
fix: tests (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
kbond committed Dec 1, 2022
1 parent 591bdd4 commit 9f6024a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 51 deletions.
33 changes: 2 additions & 31 deletions .github/workflows/ci.yml
Expand Up @@ -7,38 +7,11 @@ on:
- cron: '0 0 1,16 * *'

jobs:
tests:
name: PHP ${{ matrix.php }}, SF ${{ matrix.symfony }} - ${{ matrix.deps }}
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.4, 8.0, 8.1]
deps: [hightest]
symfony: [5.4.*]
include:
- php: 7.4
deps: lowest
symfony: '*'
- php: 8.0
deps: highest
symfony: 6.0.*
- php: 8.1
deps: highest
symfony: 6.0.*
- php: 8.1
deps: highest
symfony: 6.1.*
steps:
- uses: zenstruck/.github@php-test-symfony
with:
php: ${{ matrix.php }}
symfony: ${{ matrix.symfony }}
deps: ${{ matrix.deps }}
test:
uses: zenstruck/.github/.github/workflows/php-test-symfony.yml@main

code-coverage:
uses: zenstruck/.github/.github/workflows/php-coverage-codecov.yml@main
with:
php: 8.1

composer-validate:
uses: zenstruck/.github/.github/workflows/php-composer-validate.yml@main
Expand All @@ -50,5 +23,3 @@ jobs:

sca:
uses: zenstruck/.github/.github/workflows/php-stan.yml@main
with:
php: 8.1
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Expand Up @@ -41,7 +41,7 @@
'remove_inheritdoc' => true,
],
'phpdoc_to_comment' => false,
'function_declaration' => ['closure_function_spacing' => 'none'],
'function_declaration' => ['closure_function_spacing' => 'none', 'closure_fn_spacing' => 'none'],
'nullable_type_declaration_for_default_null_value' => true,
])
->setRiskyAllowed(true)
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -29,10 +29,10 @@
"phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^9.5",
"symfony/mime": "^5.4|^6.0",
"symfony/panther": "^1.1|^2.0",
"symfony/panther": "^1.1|^2.0.1",
"symfony/phpunit-bridge": "^6.0",
"symfony/security-bundle": "^5.4|^6.0",
"zenstruck/foundry": "^1.17"
"zenstruck/foundry": "^1.23"
},
"suggest": {
"justinrainbow/json-schema": "Json schema validator. Needed to use Json::assertMatchesSchema().",
Expand Down
2 changes: 1 addition & 1 deletion tests/BrowserTests.php
Expand Up @@ -663,7 +663,7 @@ protected static function catchVarDumperOutput(callable $callback): array
$callback();

// reset to default handler
VarDumper::setHandler();
VarDumper::setHandler(null);

// a null value is added to the beginning
return \array_values(\array_filter($output));
Expand Down
5 changes: 5 additions & 0 deletions tests/Fixture/Kernel.php
Expand Up @@ -17,6 +17,7 @@
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Core\User\InMemoryUser;
use Zenstruck\Foundry\ZenstruckFoundryBundle;

/**
* @author Kevin Bond <kevinbond@gmail.com>
Expand Down Expand Up @@ -151,6 +152,7 @@ public function registerBundles(): iterable
{
yield new FrameworkBundle();
yield new SecurityBundle();
yield new ZenstruckFoundryBundle();
}

protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader): void
Expand Down Expand Up @@ -179,6 +181,9 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
],
]],
]);
$c->loadFromExtension('zenstruck_foundry', [
'auto_refresh_proxies' => false,
]);
$c->register('logger', NullLogger::class); // disable logging
}

Expand Down
19 changes: 3 additions & 16 deletions tests/KernelBrowserAuthenticationTest.php
Expand Up @@ -8,9 +8,7 @@
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\User\InMemoryUser;
use Zenstruck\Browser\Test\HasBrowser;
use Zenstruck\Browser\Tests\Fixture\Kernel;
use Zenstruck\Foundry\Configuration;
use Zenstruck\Foundry\Factory;
use Zenstruck\Foundry\Test\Factories;

use function Zenstruck\Foundry\factory;

Expand All @@ -19,7 +17,7 @@
*/
final class KernelBrowserAuthenticationTest extends KernelTestCase
{
use HasBrowser;
use Factories, HasBrowser;

/**
* @test
Expand All @@ -39,9 +37,6 @@ public function can_act_as_user(): void
*/
public function can_act_as_user_with_foundry_factory(): void
{
// todo remove this requirement in foundry
Factory::boot(new Configuration());

$user = factory(InMemoryUser::class, ['username' => 'kevin', 'password' => 'pass']);

$this->browser()
Expand All @@ -57,9 +52,6 @@ public function can_act_as_user_with_foundry_factory(): void
*/
public function can_act_as_user_with_foundry_proxy(): void
{
// todo remove this requirement in foundry
Factory::boot(new Configuration());

$user = factory(InMemoryUser::class)->create(['username' => 'kevin', 'password' => 'pass']);

$this->browser()
Expand All @@ -75,9 +67,6 @@ public function can_act_as_user_with_foundry_proxy(): void
*/
public function can_make_authentication_assertions(): void
{
// todo remove this requirement in foundry
Factory::boot(new Configuration());

$username = 'kevin';
$user = new InMemoryUser('kevin', 'pass');
$factory = factory(InMemoryUser::class, ['username' => 'kevin', 'password' => 'pass']);
Expand Down Expand Up @@ -114,9 +103,7 @@ public function can_check_if_not_authenticated_after_request(): void
*/
public function can_authenticate_with_form_login_and_remember_me(): void
{
if (Kernel::VERSION_ID < 60000) {
$this->markTestIncomplete('For some reason, the login token is always remember me, even before expiring the session'); // todo
}
$this->markTestIncomplete('For some reason, under certain dependency conditions, the login token is always remember me, even before expiring the session'); // todo

$this->browser()
->visit('/user')
Expand Down

0 comments on commit 9f6024a

Please sign in to comment.