<commit_before><?php

class EmployeeTest extends SuiteCRM\StateChecker_PHPUnit_Framework_TestCase
{
    public function setUp()
    {
        parent::setUp();

        global $current_user;
        get_sugar_config_defaults();
        $current_user = new User();
    }

    public function testEmployee()
    {

        //execute the contructor and check for the Object type and  attributes
        $employee = new Employee();
        $this->assertInstanceOf('Employee', $employee);
        $this->assertInstanceOf('Person', $employee);
        $this->assertInstanceOf('SugarBean', $employee);

        $this->assertAttributeEquals('Employees', 'module_dir', $employee);
        $this->assertAttributeEquals('Employee', 'object_name', $employee);
        $this->assertAttributeEquals('users', 'table_name', $employee);
        $this->assertAttributeEquals(true, 'new_schema', $employee);
    }


    public function testget_summary_text()
    {
        $state = new SuiteCRM\StateSaver();
        $state->pushErrorLevel();
        
        //error_reporting(E_ERROR | E_PARSE);

        $employee = new Employee();

        //test without setting name
        $this->assertEquals(' ', $employee->get_summary_text());

        //test with name set
        $employee->retrieve(1);
        $this->assertEquals('Administrator', $employee->get_summary_text());
        
        // clean up
        
        $state->popErrorLevel();
    }


    public function testfill_in_additional_list_fields()
    {
        $state = new SuiteCRM\StateSaver();
        $state->pushErrorLevel();
        
        //error_reporting(E_ERROR | E_PARSE);
        
        
        $employee = new Employee();

        //execute the method and test if it works and does not throws an exception.
        try {
            $employee->fill_in_additional_list_fields();
            $this->assertTrue(true);
        } catch (Exception $e) {
            $this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
        }
        
        // clean up
        
        $state->popErrorLevel();
    }

    public function testfill_in_additional_detail_fields()
    {
        $employee = new Employee();


        //test with a empty employee bean
        $employee->fill_in_additional_detail_fields();
        $this->assertEquals("", $employee->reports_to_name);


        //test with a valid employee bean
        $employee->retrieve(1);
        $employee->fill_in_additional_detail_fields();
        $this->assertEquals("", $employee->reports_to_name);
    }

    public function testretrieve_employee_id()
    {
        $employee = new Employee();
        //$this->assertEquals('1' ,$employee->retrieve_employee_id('admin'));

        $this->markTestSkipped('Bug in query: employee_name parameter is wrongly used as user_name');
    }


    public function testverify_data()
    {

	// save state

        $state = new \SuiteCRM\StateSaver();
        $state->pushTable('email_addresses');

	// test
        
        $employee = new Employee();
        $this->assertEquals(true, $employee->verify_data());

        
        // clean up
        
        $state->popTable('email_addresses');
    }

    public function testget_list_view_data()
    {

	// save state

        $state = new \SuiteCRM\StateSaver();
        $state->pushTable('aod_index');
        $state->pushTable('email_addresses');
        
        
        $employee = new Employee();

        $expected = array(
            'SUGAR_LOGIN' => '1',
            'FULL_NAME' => ' ',
            'NAME' => ' ',
            'IS_ADMIN' => '0',
            'EXTERNAL_AUTH_ONLY' => '0',
            'RECEIVE_NOTIFICATIONS' => '1',
            'DELETED' => 0,
            'PORTAL_ONLY' => '0',
            'SHOW_ON_EMPLOYEES' => '1',
            'ENCODED_NAME' => ' ',
            'EMAIL1' => '',
            'EMAIL1_LINK' =>
                '<a class="email-link" href="javascript:void(0);"'
                . ' onclick="$(document).openComposeViewModal(this);'
                . '" data-module="Employees" data-record-id="" data-module-name=" " data-email-address=""></a>',
            'MESSENGER_TYPE' => '',
            'REPORTS_TO_NAME' => null,
        );

        $actual = $employee->get_list_view_data();
        $this->assertSame($expected, $actual);

        // clean up
        
        $state->popTable('email_addresses');
        $state->popTable('aod_index');
    }

    public function testlist_view_parse_additional_sections()
    {
        $state = new SuiteCRM\StateSaver();
        $state->pushErrorLevel();
        
        //error_reporting(E_ERROR | E_PARSE);
        
        
        $employee = new Employee();

        //execute the method and test if it works and does not throws an exception.
        try {
            $employee->list_view_parse_additional_sections(new Sugar_Smarty(), null);
            $this->assertTrue(true);
        } catch (Exception $e) {
            $this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
        }
        
        // clean up
        
        $state->popErrorLevel();
    }


    public function testcreate_export_query()
    {<commit_msg>fixing EmployeeTest<commit_after><?php

class EmployeeTest extends SuiteCRM\StateChecker_PHPUnit_Framework_TestCase
{
    public function setUp()
    {
        parent::setUp();

        global $current_user;
        get_sugar_config_defaults();
        $current_user = new User();
    }

    public function testEmployee()
    {

        //execute the contructor and check for the Object type and  attributes
        $employee = new Employee();
        $this->assertInstanceOf('Employee', $employee);
        $this->assertInstanceOf('Person', $employee);
        $this->assertInstanceOf('SugarBean', $employee);

        $this->assertAttributeEquals('Employees', 'module_dir', $employee);
        $this->assertAttributeEquals('Employee', 'object_name', $employee);
        $this->assertAttributeEquals('users', 'table_name', $employee);
        $this->assertAttributeEquals(true, 'new_schema', $employee);
    }


    public function testget_summary_text()
    {
        $state = new SuiteCRM\StateSaver();
        $state->pushErrorLevel();
        
        //error_reporting(E_ERROR | E_PARSE);

        $employee = new Employee();

        //test without setting name
        $this->assertEquals(' ', $employee->get_summary_text());

        //test with name set
        $employee->retrieve(1);
        $this->assertEquals('Administrator', $employee->get_summary_text());
        
        // clean up
        
        $state->popErrorLevel();
    }


    public function testfill_in_additional_list_fields()
    {
        $state = new SuiteCRM\StateSaver();
        $state->pushErrorLevel();
        
        //error_reporting(E_ERROR | E_PARSE);
        
        
        $employee = new Employee();

        //execute the method and test if it works and does not throws an exception.
        try {
            $employee->fill_in_additional_list_fields();
            $this->assertTrue(true);
        } catch (Exception $e) {
            $this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
        }
        
        // clean up
        
        $state->popErrorLevel();
    }

    public function testfill_in_additional_detail_fields()
    {
        $employee = new Employee();


        //test with a empty employee bean
        $employee->fill_in_additional_detail_fields();
        $this->assertEquals("", $employee->reports_to_name);


        //test with a valid employee bean
        $employee->retrieve(1);
        $employee->fill_in_additional_detail_fields();
        $this->assertEquals("", $employee->reports_to_name);
    }

    public function testretrieve_employee_id()
    {
        $employee = new Employee();
        //$this->assertEquals('1' ,$employee->retrieve_employee_id('admin'));

        $this->markTestSkipped('Bug in query: employee_name parameter is wrongly used as user_name');
    }


    public function testverify_data()
    {

	// save state

        $state = new \SuiteCRM\StateSaver();
        $state->pushTable('email_addresses');

	// test
        
        $employee = new Employee();
        $this->assertEquals(true, $employee->verify_data());

        
        // clean up
        
        $state->popTable('email_addresses');
    }

    public function testget_list_view_data()
    {

	// save state

        $state = new \SuiteCRM\StateSaver();
        $state->pushTable('aod_index');
        $state->pushTable('email_addresses');
        $state->pushTable('tracker');
        
        
        $employee = new Employee();

        $expected = array(
            'SUGAR_LOGIN' => '1',
            'FULL_NAME' => ' ',
            'NAME' => ' ',
            'IS_ADMIN' => '0',
            'EXTERNAL_AUTH_ONLY' => '0',
            'RECEIVE_NOTIFICATIONS' => '1',
            'DELETED' => 0,
            'PORTAL_ONLY' => '0',
            'SHOW_ON_EMPLOYEES' => '1',
            'ENCODED_NAME' => ' ',
            'EMAIL1' => '',
            'EMAIL1_LINK' =>
                '<a class="email-link" href="javascript:void(0);"'
                . ' onclick="$(document).openComposeViewModal(this);'
                . '" data-module="Employees" data-record-id="" data-module-name=" " data-email-address=""></a>',
            'MESSENGER_TYPE' => '',
            'REPORTS_TO_NAME' => null,
        );

        $actual = $employee->get_list_view_data();
        $this->assertSame($expected, $actual);

        // clean up
        
        $state->popTable('tracker');
        $state->popTable('email_addresses');
        $state->popTable('aod_index');
    }

    public function testlist_view_parse_additional_sections()
    {
        $state = new SuiteCRM\StateSaver();
        $state->pushErrorLevel();
        
        //error_reporting(E_ERROR | E_PARSE);
        
        
        $employee = new Employee();

        //execute the method and test if it works and does not throws an exception.
        try {
            $employee->list_view_parse_additional_sections(new Sugar_Smarty(), null);
            $this->assertTrue(true);
        } catch (Exception $e) {
            $this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
        }
        
        // clean up
        
        $state->popErrorLevel();
    }


    public function testcreate_export_query()
    {
{'fraction_non_alphanumeric': 0.13911038524353925, 'fraction_numerical': 0.0024978384090690747, 'mean_word_length': 2.101907032181168, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 133, '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': '244718', 'n_tokens_mistral': 3117, 'n_tokens_neox': 2931, 'n_words': 549}