<commit_before><?php

class AOW_WorkFlowTest extends SuiteCRM\StateCheckerPHPUnitTestCaseAbstract
{
    public function testAOW_WorkFlow()
    {

        //execute the contructor and check for the Object type and  attributes
        $aowWorkFlow = new AOW_WorkFlow();
        $this->assertInstanceOf('AOW_WorkFlow', $aowWorkFlow);
        $this->assertInstanceOf('Basic', $aowWorkFlow);
        $this->assertInstanceOf('SugarBean', $aowWorkFlow);

        $this->assertAttributeEquals('AOW_WorkFlow', 'module_dir', $aowWorkFlow);
        $this->assertAttributeEquals('AOW_WorkFlow', 'object_name', $aowWorkFlow);
        $this->assertAttributeEquals('aow_workflow', 'table_name', $aowWorkFlow);
        $this->assertAttributeEquals(true, 'new_schema', $aowWorkFlow);
        $this->assertAttributeEquals(true, 'disable_row_level_security', $aowWorkFlow);
        $this->assertAttributeEquals(false, 'importable', $aowWorkFlow);
    }

    public function testbean_implements()
    {

        $aowWorkFlow = new AOW_WorkFlow();
        $this->assertEquals(false, $aowWorkFlow->bean_implements('')); //test with blank value
        $this->assertEquals(false, $aowWorkFlow->bean_implements('test')); //test with invalid value
        $this->assertEquals(true, $aowWorkFlow->bean_implements('ACL')); //test with valid value
    }

    public function testsave()
    {
        $aowWorkFlow = new AOW_WorkFlow();

        $aowWorkFlow->name = 'test';
        $aowWorkFlow->flow_module = 'test';

        $aowWorkFlow->save();

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

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

    public function testload_flow_beans()
    {
        $aowWorkFlow = new AOW_WorkFlow();

        //execute the method and test if it works and does not throws an exception.
        try {
            $aowWorkFlow->load_flow_beans();
            $this->assertTrue(true);
        } catch (Exception $e) {
            $this->fail("\nException: " . get_class($e) . ": " . $e->getMessage() . "\nin " . $e->getFile() . ':' . $e->getLine() . "\nTrace:\n" . $e->getTraceAsString() . "\n");
        }
    }

    public function testrun_flows()
    {
        $aowWorkFlow = new AOW_WorkFlow();

        $result = $aowWorkFlow->run_flows();
        $this->assertTrue($result);
    }

    public function testrun_flow()
    {
        $aowWorkFlow = new AOW_WorkFlow();

        //execute the method and test if it works and does not throws an exception.
        try {
            $aowWorkFlow->run_flow();
            $this->assertTrue(true);
        } catch (Exception $e) {
            $this->fail("\nException: " . get_class($e) . ": " . $e->getMessage() . "\nin " . $e->getFile() . ':' . $e->getLine() . "\nTrace:\n" . $e->getTraceAsString() . "\n");
        }
    }

    public function testrun_bean_flows()
    {
        $aowWorkFlow = new AOW_WorkFlow();

        //test with different modules. it always returns true

        $result = $aowWorkFlow->run_bean_flows(new AOS_Quotes());
        $this->assertTrue($result);

        $result = $aowWorkFlow->run_bean_flows(new Call());
        $this->assertTrue($result);
    }

    public function testget_flow_beans()
    {
        $aowWorkFlow = new AOW_WorkFlow();

        //test for AOS_Quotes. it will return null as no test data is available
        $aowWorkFlow->flow_module = 'AOS_Quotes';<commit_msg>fixing aow workflow test<commit_after><?php

class AOW_WorkFlowTest extends SuiteCRM\StateCheckerPHPUnitTestCaseAbstract
{
    public function testAOW_WorkFlow()
    {

        //execute the contructor and check for the Object type and  attributes
        $aowWorkFlow = new AOW_WorkFlow();
        $this->assertInstanceOf('AOW_WorkFlow', $aowWorkFlow);
        $this->assertInstanceOf('Basic', $aowWorkFlow);
        $this->assertInstanceOf('SugarBean', $aowWorkFlow);

        $this->assertAttributeEquals('AOW_WorkFlow', 'module_dir', $aowWorkFlow);
        $this->assertAttributeEquals('AOW_WorkFlow', 'object_name', $aowWorkFlow);
        $this->assertAttributeEquals('aow_workflow', 'table_name', $aowWorkFlow);
        $this->assertAttributeEquals(true, 'new_schema', $aowWorkFlow);
        $this->assertAttributeEquals(true, 'disable_row_level_security', $aowWorkFlow);
        $this->assertAttributeEquals(false, 'importable', $aowWorkFlow);
    }

    public function testbean_implements()
    {

        $aowWorkFlow = new AOW_WorkFlow();
        $this->assertEquals(false, $aowWorkFlow->bean_implements('')); //test with blank value
        $this->assertEquals(false, $aowWorkFlow->bean_implements('test')); //test with invalid value
        $this->assertEquals(true, $aowWorkFlow->bean_implements('ACL')); //test with valid value
    }

    public function testsave()
    {
        $aowWorkFlow = new AOW_WorkFlow();

        $aowWorkFlow->name = 'test';
        $aowWorkFlow->flow_module = 'test';

        $aowWorkFlow->save();

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

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

    public function testload_flow_beans()
    {
        $aowWorkFlow = new AOW_WorkFlow();

        //execute the method and test if it works and does not throws an exception.
        try {
            $aowWorkFlow->load_flow_beans();
            $this->assertTrue(true);
        } catch (Exception $e) {
            $this->fail("\nException: " . get_class($e) . ": " . $e->getMessage() . "\nin " . $e->getFile() . ':' . $e->getLine() . "\nTrace:\n" . $e->getTraceAsString() . "\n");
        }
    }

    public function testrun_flows()
    {
        $aowWorkFlow = new AOW_WorkFlow();

        $result = $aowWorkFlow->run_flows();
        $this->assertTrue($result);
    }

    public function testrun_flow()
    {
        $aowWorkFlow = new AOW_WorkFlow();

        //execute the method and test if it works and does not throws an exception.
        try {
            $aowWorkFlow->run_flow();
            $this->assertTrue(true);
        } catch (Exception $e) {
            $this->fail("\nException: " . get_class($e) . ": " . $e->getMessage() . "\nin " . $e->getFile() . ':' . $e->getLine() . "\nTrace:\n" . $e->getTraceAsString() . "\n");
        }
    }

    public function testrun_bean_flows()
    {
        $aowWorkFlow = new AOW_WorkFlow();

        //test with different modules. it always returns true

        $quotes = new AOS_Quotes();
        $result = $aowWorkFlow->run_bean_flows($quotes);
        $this->assertTrue($result);

        $calls = new Call();
        $result = $aowWorkFlow->run_bean_flows($calls);
        $this->assertTrue($result);
    }

    public function testget_flow_beans()
    {
        $aowWorkFlow = new AOW_WorkFlow();

        //test for AOS_Quotes. it will return null as no test data is available
        $aowWorkFlow->flow_module = 'AOS_Quotes';
{'fraction_non_alphanumeric': 0.1434113712374582, 'fraction_numerical': 0.0005351170568561873, 'mean_word_length': 2.771947527749748, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 99, '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': '7585389', 'n_tokens_mistral': 2349, 'n_tokens_neox': 2299, 'n_words': 478}