<commit_before><?php

class TaskTest extends SuiteCRM\StateCheckerPHPUnitTestCaseAbstract
{
    public function testTask()
    {

        //execute the contructor and check for the Object type and  attributes
        $task = new Task();

        $this->assertInstanceOf('Task', $task);
        $this->assertInstanceOf('SugarBean', $task);

        $this->assertAttributeEquals('tasks', 'table_name', $task);
        $this->assertAttributeEquals('Tasks', 'module_dir', $task);
        $this->assertAttributeEquals('Task', 'object_name', $task);

        $this->assertAttributeEquals(true, 'new_schema', $task);
        $this->assertAttributeEquals(true, 'importable', $task);
    }

    public function testsave()
    {

        $task = new Task();

        $task->name = 'test';
        $task->priority = 'Medium';
        $task->parent_type = 'Accounts';
        $task->status = 'In Progress';

        $result = $task->save();

        //test for record ID to verify that record is saved
        $this->assertTrue(isset($task->id));
        $this->assertEquals(36, strlen($task->id));

        //mark the record as deleted and verify that this record cannot be retrieved anymore.
        $task->mark_deleted($task->id);
        $result = $task->retrieve($task->id);
        $this->assertEquals(null, $result);
    }

    public function testget_summary_text()
    {
        $task = new Task();

        //test without setting name
        $this->assertEquals(null, $task->get_summary_text());

        //test with name set
        $task->name = 'test';
        $this->assertEquals('test', $task->get_summary_text());
    }

    public function testcreate_export_query()
    {
        $task = new Task();

        //test with empty string params
        $expected = 'SELECT tasks.*, users.user_name as assigned_user_name  FROM tasks   LEFT JOIN users ON tasks.assigned_user_id=users.id where tasks.deleted=0 ORDER BY tasks.name';
        $actual = $task->create_export_query('', '');
        $this->assertSame($expected, $actual);<commit_msg>fixing Task test<commit_after><?php

class TaskTest extends SuiteCRM\StateCheckerPHPUnitTestCaseAbstract
{
    public function testTask()
    {

        //execute the contructor and check for the Object type and  attributes
        $task = new Task();

        $this->assertInstanceOf('Task', $task);
        $this->assertInstanceOf('SugarBean', $task);

        $this->assertAttributeEquals('tasks', 'table_name', $task);
        $this->assertAttributeEquals('Tasks', 'module_dir', $task);
        $this->assertAttributeEquals('Task', 'object_name', $task);

        $this->assertAttributeEquals(true, 'new_schema', $task);
        $this->assertAttributeEquals(true, 'importable', $task);
    }

    public function testsave()
    {
        // save state
        
        $state = new SuiteCRM\StateSaver();
        $state->pushTable('tasks');
        $state->pushTable('aod_indexevent');
        $state->pushGlobals();
        
        // test
        


        $task = new Task();

        $task->name = 'test';
        $task->priority = 'Medium';
        $task->parent_type = 'Accounts';
        $task->status = 'In Progress';

        $result = $task->save();

        //test for record ID to verify that record is saved
        $this->assertTrue(isset($task->id));
        $this->assertEquals(36, strlen($task->id));

        //mark the record as deleted and verify that this record cannot be retrieved anymore.
        $task->mark_deleted($task->id);
        $result = $task->retrieve($task->id);
        $this->assertEquals(null, $result);
        
        // cleanup
        
        $state->popGlobals();
        $state->popTable('aod_indexevent');
        $state->popTable('tasks');
    }

    public function testget_summary_text()
    {
        $task = new Task();

        //test without setting name
        $this->assertEquals(null, $task->get_summary_text());

        //test with name set
        $task->name = 'test';
        $this->assertEquals('test', $task->get_summary_text());
    }

    public function testcreate_export_query()
    {
        $task = new Task();

        //test with empty string params
        $expected = 'SELECT tasks.*, users.user_name as assigned_user_name  FROM tasks   LEFT JOIN users ON tasks.assigned_user_id=users.id where tasks.deleted=0 ORDER BY tasks.name';
        $actual = $task->create_export_query('', '');
        $this->assertSame($expected, $actual);
{'fraction_non_alphanumeric': 0.1440430783037918, 'fraction_numerical': 0.0013461969934933811, 'mean_word_length': 2.598062953995157, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 65, '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': '4997138', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1236, 'n_words': 302}