<commit_before><?php

namespace Tests\Functional;

class SearchTasksTest extends BaseTest
{
    public function testSearchTasksOrder()
    {
        $client = self::createClient();
        $client->request('POST', '/task/search', [
            'authorization' => $this->getAuthToken(),
            'order' => '1',
        ], [], ['HTTP_authorization' => $this->getAuthToken()]);

        $result = $client->getResponse()->getContent();

        $this->assertEquals(200, $client->getResponse()->getStatusCode());
        $this->assertTrue($client->getResponse()->isSuccessful());
        $this->assertContains('success', $result);
        $this->assertNotContains('error', $result);
        $this->assertNotContains('not authorized', $result);
    }

    public function testSearchTasksFilter2()
    {
        $client = self::createClient();
        $client->request('POST', '/task/search', [
            'authorization' => $this->getAuthToken(),
            'filter' => '2',
        ], [], ['HTTP_authorization' => $this->getAuthToken()]);

        $result = $client->getResponse()->getContent();

        $this->assertEquals(200, $client->getResponse()->getStatusCode());
        $this->assertTrue($client->getResponse()->isSuccessful());
        $this->assertContains('success', $result);
        $this->assertContains('todo', $result);
        $this->assertNotContains('error', $result);
        $this->assertNotContains('not authorized', $result);
    }

    public function testSearchTasksFilter3()
    {
        $client = self::createClient();
        $client->request('POST', '/task/search', [
            'authorization' => $this->getAuthToken(),
            'filter' => '3',
        ], [], ['HTTP_authorization' => $this->getAuthToken()]);

        $result = $client->getResponse()->getContent();

        $this->assertEquals(200, $client->getResponse()->getStatusCode());
        $this->assertTrue($client->getResponse()->isSuccessful());
        $this->assertContains('success', $result);
        $this->assertContains('finished', $result);
        $this->assertNotContains('error', $result);
        $this->assertNotContains('not authorized', $result);
    }

    public function testSearchTasks()
    {
        $client = self::createClient();
        $client->request('POST', '/task/search/t', [
            'authorization' => $this->getAuthToken(),
        ], [], ['HTTP_authorization' => $this->getAuthToken()]);

        $result = $client->getResponse()->getContent();

        $this->assertEquals(200, $client->getResponse()->getStatusCode());
        $this->assertTrue($client->getResponse()->isSuccessful());
        $this->assertContains('success', $result);
        $this->assertNotContains('error', $result);
        $this->assertNotContains('not authorized', $result);
    }

    public function testSearchTasksError()
    {
        $client = self::createClient();
        $client->request('POST', '/task/search');

        $this->assertEquals(403, $client->getResponse()->getStatusCode());
        $this->assertContains('error', $client->getResponse()->getContent());
        $this->assertContains('not authorized', $client->getResponse()->getContent());
        $this->assertNotContains('success', $client->getResponse()->getContent());
    }
}<commit_msg>Fix in search tasks tests.<commit_after><?php

namespace Tests\Functional;

class SearchTasksTest extends BaseTest
{
    public function testSearchTasksOrder()
    {
        $client = self::createClient();
        $client->request('POST', '/task/search', [
            'authorization' => $this->getAuthToken(),
            'order' => '1',
        ], [], ['HTTP_authorization' => $this->getAuthToken()]);

        $result = $client->getResponse()->getContent();

        $this->assertEquals(200, $client->getResponse()->getStatusCode());
        $this->assertTrue($client->getResponse()->isSuccessful());
        $this->assertContains('success', $result);
        $this->assertNotContains('not authorized', $result);
    }

    public function testSearchTasksFilter2()
    {
        $client = self::createClient();
        $client->request('POST', '/task/search', [
            'authorization' => $this->getAuthToken(),
            'filter' => '2',
        ], [], ['HTTP_authorization' => $this->getAuthToken()]);

        $result = $client->getResponse()->getContent();

        $this->assertEquals(200, $client->getResponse()->getStatusCode());
        $this->assertTrue($client->getResponse()->isSuccessful());
        $this->assertContains('success', $result);
        $this->assertContains('todo', $result);
        $this->assertNotContains('error', $result);
        $this->assertNotContains('not authorized', $result);
    }

    public function testSearchTasksFilter3()
    {
        $client = self::createClient();
        $client->request('POST', '/task/search', [
            'authorization' => $this->getAuthToken(),
            'filter' => '3',
        ], [], ['HTTP_authorization' => $this->getAuthToken()]);

        $result = $client->getResponse()->getContent();

        $this->assertEquals(200, $client->getResponse()->getStatusCode());
        $this->assertTrue($client->getResponse()->isSuccessful());
        $this->assertContains('success', $result);
        $this->assertContains('finished', $result);
        $this->assertNotContains('not authorized', $result);
    }

    public function testSearchTasks()
    {
        $client = self::createClient();
        $client->request('POST', '/task/search/t', [
            'authorization' => $this->getAuthToken(),
        ], [], ['HTTP_authorization' => $this->getAuthToken()]);

        $result = $client->getResponse()->getContent();

        $this->assertEquals(200, $client->getResponse()->getStatusCode());
        $this->assertTrue($client->getResponse()->isSuccessful());
        $this->assertContains('success', $result);
        $this->assertNotContains('not authorized', $result);
    }

    public function testSearchTasksError()
    {
        $client = self::createClient();
        $client->request('POST', '/task/search');

        $this->assertEquals(403, $client->getResponse()->getStatusCode());
        $this->assertContains('error', $client->getResponse()->getContent());
        $this->assertContains('not authorized', $client->getResponse()->getContent());
        $this->assertNotContains('success', $client->getResponse()->getContent());
    }
}
{'fraction_non_alphanumeric': 0.19644804486680167, 'fraction_numerical': 0.006231500233681258, 'mean_word_length': 3.288577154308617, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 164, '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': '5702564', 'n_tokens_mistral': 1719, 'n_tokens_neox': 1691, 'n_words': 248}