<commit_before><?php

use App\Libraries\UserVerification;
use App\Models\User;

class AccountControllerTest extends TestCase
{
    public function setUp()
    {
        parent::setUp();

        $this->user = factory(User::class)->create();
    }

    /**
     * Checks whether an OK status is returned when the
     * profile order update request is valid.
     */
    public function testValidProfileOrderChangeRequest()
    {
        $newOrder = [
            'historical',
            'medals',
            'beatmaps',
            'top_ranks',
            'kudosu',
            'recent_activities',
            'me',
            'performance',
        ];

        $this->actingAs($this->user)
            ->withSession(['verified' => UserVerification::VERIFIED])
            ->json('PUT', route('account.extras-order'), [
                'order' => $newOrder,
            ])
            ->seeJson(['profileOrder' => $newOrder]);
    }

    public function testDuplicatesInProfileOrder()
    {
        $newOrder = [
            'me',
            'recent_activities',
            'kudosu',
            'top_ranks',
            'beatmaps',
            'medals',
            'historical',
            'performance',
        ];

        $newOrderWithDuplicate = $newOrder;
        $newOrderWithDuplicate[] = 'me';

        $this->actingAs($this->user)
            ->withSession(['verified' => UserVerification::VERIFIED])
            ->json('PUT', route('account.extras-order'), [
                'order' => $newOrderWithDuplicate,
            ])
            ->seeJson(['profileOrder' => $newOrder]);
    }

    public function testInvalidIdsInProfileOrder()
    {
        $newOrder = [
            'me',
            'recent_activities',
            'kudosu',
            'top_ranks',
            'beatmaps',
            'medals',
            'historical',
            'performance',
        ];

        $newOrderWithInvalid = $newOrder;
        $newOrderWithInvalid[] = 'test';

        $this->actingAs($this->user)
            ->withSession(['verified' => UserVerification::VERIFIED])
            ->json('PUT', route('account.extras-order'), [
                'order' => $newOrderWithInvalid,
            ])
            ->seeJson(['profileOrder' => $newOrder]);
    }
}<commit_msg>Update tests<commit_after><?php

use App\Libraries\UserVerification;
use App\Models\User;

class AccountControllerTest extends TestCase
{
    public function setUp()
    {
        parent::setUp();

        $this->user = factory(User::class)->create();
    }

    /**
     * Checks whether an OK status is returned when the
     * profile order update request is valid.
     */
    public function testValidProfileOrderChangeRequest()
    {
        $newOrder = [
            'historical',
            'medals',
            'beatmaps',
            'top_ranks',
            'kudosu',
            'recent_activities',
            'me',
            'performance',
        ];

        $this->actingAs($this->user)
            ->withSession(['verified' => UserVerification::VERIFIED])
            ->json('PUT', route('account.update'), [
                'order' => $newOrder,
            ])
            ->seeJson(['profileOrder' => $newOrder]);
    }

    public function testDuplicatesInProfileOrder()
    {
        $newOrder = [
            'me',
            'recent_activities',
            'kudosu',
            'top_ranks',
            'beatmaps',
            'medals',
            'historical',
            'performance',
        ];

        $newOrderWithDuplicate = $newOrder;
        $newOrderWithDuplicate[] = 'me';

        $this->actingAs($this->user)
            ->withSession(['verified' => UserVerification::VERIFIED])
            ->json('PUT', route('account.update'), [
                'order' => $newOrderWithDuplicate,
            ])
            ->seeJson(['profileOrder' => $newOrder]);
    }

    public function testInvalidIdsInProfileOrder()
    {
        $newOrder = [
            'me',
            'recent_activities',
            'kudosu',
            'top_ranks',
            'beatmaps',
            'medals',
            'historical',
            'performance',
        ];

        $newOrderWithInvalid = $newOrder;
        $newOrderWithInvalid[] = 'test';

        $this->actingAs($this->user)
            ->withSession(['verified' => UserVerification::VERIFIED])
            ->json('PUT', route('account.update'), [
                'order' => $newOrderWithInvalid,
            ])
            ->seeJson(['profileOrder' => $newOrder]);
    }
}
{'fraction_non_alphanumeric': 0.1427942794279428, 'fraction_numerical': 0.0, 'mean_word_length': 1.6725455614344504, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 55, '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': '2001621', 'n_tokens_mistral': 1283, 'n_tokens_neox': 1235, 'n_words': 203}