<commit_before><?php
declare(strict_types=1);
/**
 * /tests/Integration/Controller/ProfileControllerTest.php
 *
 * @author TLe, <NAME> <<EMAIL>>
 */
namespace App\Tests\Integration\Controller;

use App\Controller\ProfileController;
use App\Security\RolesService;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\User\User;

/**
 * Class ProfileControllerTest
 *
 * @package App\Tests\Integration\Controller
 * @author TLe, <NAME> <<EMAIL>>
 */
class ProfileControllerTest extends KernelTestCase
{
    /**
     * @expectedException \Symfony\Component\Security\Core\Exception\AccessDeniedException
     * @expectedExceptionMessage Not supported user
     */
    public function testThatProfileActionThrowsAnExceptionIfTokenStorageContainsWrongUserInstance(): void
    {
        self::bootKernel();

        $serializer = static::$kernel->getContainer()->get('serializer');
        $rolesService = static::$kernel->getContainer()->get(RolesService::class);

        $user = new User('test_user', '<PASSWORD>');
        $token = new PreAuthenticatedToken($user, 'credentials', 'providerKey', [RolesService::ROLE_LOGGED]);

        $tokenStorage = new TokenStorage();
        $tokenStorage->setToken($token);

        $controller = new ProfileController();
        $controller->profileAction($tokenStorage, $serializer, $rolesService);
    }

    public function testThatGroupsActionThrowsAnExceptionIfTokenStorageContainsWrongUserInstance(): void
    {
        self::bootKernel();

        $serializer = static::$kernel->getContainer()->get('serializer');

        $user = new User('test_user', '<PASSWORD>');
        $token = new PreAuthenticatedToken($user, 'credentials', 'providerKey', [RolesService::ROLE_LOGGED]);<commit_msg>tests: Added missing ExpectedException data<commit_after><?php
declare(strict_types=1);
/**
 * /tests/Integration/Controller/ProfileControllerTest.php
 *
 * @author TLe, <NAME> <<EMAIL>>
 */
namespace App\Tests\Integration\Controller;

use App\Controller\ProfileController;
use App\Security\RolesService;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\User\User;

/**
 * Class ProfileControllerTest
 *
 * @package App\Tests\Integration\Controller
 * @author TLe, <NAME> <<EMAIL>>
 */
class ProfileControllerTest extends KernelTestCase
{
    /**
     * @expectedException \Symfony\Component\Security\Core\Exception\AccessDeniedException
     * @expectedExceptionMessage Not supported user
     */
    public function testThatProfileActionThrowsAnExceptionIfTokenStorageContainsWrongUserInstance(): void
    {
        self::bootKernel();

        $serializer = static::$kernel->getContainer()->get('serializer');
        $rolesService = static::$kernel->getContainer()->get(RolesService::class);

        $user = new User('test_user', '<PASSWORD>');
        $token = new PreAuthenticatedToken($user, 'credentials', 'providerKey', [RolesService::ROLE_LOGGED]);

        $tokenStorage = new TokenStorage();
        $tokenStorage->setToken($token);

        $controller = new ProfileController();
        $controller->profileAction($tokenStorage, $serializer, $rolesService);
    }

    /**
     * @expectedException \Symfony\Component\Security\Core\Exception\AccessDeniedException
     * @expectedExceptionMessage Not supported user
     */
    public function testThatGroupsActionThrowsAnExceptionIfTokenStorageContainsWrongUserInstance(): void
    {
        self::bootKernel();

        $serializer = static::$kernel->getContainer()->get('serializer');

        $user = new User('test_user', '<PASSWORD>');
        $token = new PreAuthenticatedToken($user, 'credentials', 'providerKey', [RolesService::ROLE_LOGGED]);
{'fraction_non_alphanumeric': 0.13046701260192736, 'fraction_numerical': 0.0004941932295527551, 'mean_word_length': 4.766381766381766, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3517971', 'n_tokens_mistral': 1103, 'n_tokens_neox': 1093, 'n_words': 179}