Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove FOSUserBundle from tests #1750

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tests/App/UserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ public function refreshUser(UserInterface $user)

public function supportsClass($class)
{
return $class instanceof User;
return User::class === $class;
}
}
17 changes: 2 additions & 15 deletions Tests/App/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
framework:
secret: secret
test: ~
router: { resource: "%kernel.root_dir%/../App/routing.yml" }
router: { resource: "%kernel.project_dir%/../App/routing.yml" }
session:
handler_id: ~
storage_id: session.storage.mock_file
Expand All @@ -20,7 +20,7 @@ monolog:

security:
encoders:
HWI\Bundle\OAuthBundle\Tests\Fixtures\FOSUser: sha512
HWI\Bundle\OAuthBundle\Tests\Fixtures\User: sha512
providers:
HWI\Bundle\OAuthBundle\Tests\App\UserProvider:
id: HWI\Bundle\OAuthBundle\Tests\App\UserProvider
Expand Down Expand Up @@ -79,9 +79,6 @@ doctrine:

hwi_oauth:
connect: ~
fosub:
properties:
google: googleId
http:
client: Psr\Http\Client\ClientInterface
message_factory: Http\Message\MessageFactory\GuzzleMessageFactory
Expand All @@ -93,16 +90,6 @@ hwi_oauth:
client_secret: 'google_client_secret'
scope: "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"

fos_user:
db_driver: orm
user_class: HWI\Bundle\OAuthBundle\Tests\Fixtures\FOSUser
firewall_name: main
from_email:
address: "test@example.com"
sender_name: "test@example.com"
service:
mailer: 'fos_user.mailer.noop'

twig:
strict_variables: '%kernel.debug%'
exception_controller: ~
Expand Down
95 changes: 0 additions & 95 deletions Tests/Fixtures/FOSUser.php

This file was deleted.

11 changes: 2 additions & 9 deletions Tests/Functional/Controller/ConnectControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,11 @@
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\HttpFoundation\Session\SessionInterface;

/**
* uses FOSUserBundle which itself contains lots of deprecations.
*
* @group legacy
*/
final class ConnectControllerTest extends WebTestCase
{
protected function setUp(): void
{
static::$class = AppKernel::class;
if (!class_exists(\FOS\UserBundle\Model\User::class)) {
$this->markTestSkipped('FOSUserBundle not installed.');
}
}

public static function getKernelClass(): string
Expand Down Expand Up @@ -110,7 +102,8 @@ public function testConnectService(): void

$this->createDatabase($client);

$session = $client->getContainer()->get('request_stack')->getSession();
$session = $client->getContainer()->get('session');

$key = 1;
$session->set('_hwi_oauth.connect_confirmation.'.$key, ['access_token' => 'valid-access-token']);
$this->logIn($client, $session);
Expand Down
14 changes: 1 addition & 13 deletions Tests/Functional/Controller/LoginControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,8 @@
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\Security;

/**
* uses FOSUserBundle which itself contains lots of deprecations.
*
* @group legacy
*/
final class LoginControllerTest extends WebTestCase
{
protected function setUp(): void
{
if (!class_exists(\FOS\UserBundle\Model\User::class)) {
$this->markTestSkipped('FOSUserBundle not installed.');
}
}

public function testLoginPage(): void
{
$client = static::createClient();
Expand Down Expand Up @@ -69,7 +57,7 @@ public function testLoginPageWithError(): void
$client = static::createClient();
$httpClient = $this->prophesize(ClientInterface::class);
$client->getContainer()->set(ClientInterface::class, $httpClient->reveal());
$session = $client->getContainer()->get('request_stack')->getSession();
$session = $client->getContainer()->get('session');

$this->logIn($client, $session);
$exception = new UsernameNotFoundException();
Expand Down
8 changes: 0 additions & 8 deletions Tests/Functional/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@

class IntegrationTest extends WebTestCase
{
protected function setUp(): void
{
parent::setUp();
if (!class_exists(\FOS\UserBundle\Model\User::class)) {
$this->markTestSkipped('FOSUserBundle not installed.');
}
}

public function testRequestRedirect(): void
{
$client = static::createClient();
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,14 @@

"require-dev": {
"doctrine/doctrine-bundle": "^2.0",
"doctrine/orm": "^2.6",
"doctrine/orm": "^2.6.4",
"symfony/browser-kit": "^4.4|^5.1",
"symfony/css-selector": "^4.4|^5.1",
"symfony/property-access": "^4.4|^5.1",
"symfony/validator": "^4.4|^5.1",
"symfony/twig-bundle": "^4.4|^5.1",
"symfony/stopwatch": "^5.1",
"symfony/translation": "^4.4|^5.1",
"friendsofsymfony/user-bundle": "^2.1",
"php-http/httplug-bundle": "^1.7",
"php-http/guzzle6-adapter": "^2.0",
"phpunit/phpunit": "^9.5",
Expand Down