<commit_before><?php

class AOS_ProductsTest extends SuiteCRM\StateCheckerPHPUnitTestCaseAbstract
{
    public function testAOS_Products()
    {
        // save state
        
        $state = new SuiteCRM\StateSaver();
        $state->pushTable('aos_products');
        
        // test
        

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

        $this->assertAttributeEquals('AOS_Products', 'module_dir', $aosProducts);
        $this->assertAttributeEquals('AOS_Products', 'object_name', $aosProducts);
        $this->assertAttributeEquals('aos_products', 'table_name', $aosProducts);
        $this->assertAttributeEquals(true, 'new_schema', $aosProducts);
        $this->assertAttributeEquals(true, 'disable_row_level_security', $aosProducts);
        $this->assertAttributeEquals(true, 'importable', $aosProducts);
        
        // cleanup
        
        $state->popTable('aos_products');
    }

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

        $aosProducts = new AOS_Products();

        $aosProducts->name = 'test';
        $aosProducts->category = 1;
        $aosProducts->product_image = 'test img';
        $_POST['deleteAttachment'] = '1';

        $aosProducts->save();

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

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

    public function testgetCustomersPurchasedProductsQuery()
    {
        // save state
        
        $state = new SuiteCRM\StateSaver();
        $state->pushTable('aos_products');
        
        // test
        <commit_msg>fixing AOS_ProductsTest<commit_after><?php

class AOS_ProductsTest extends SuiteCRM\StateCheckerPHPUnitTestCaseAbstract
{
    public function testAOS_Products()
    {
        // save state
        
        $state = new SuiteCRM\StateSaver();
        $state->pushTable('aos_products');
        
        // test
        

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

        $this->assertAttributeEquals('AOS_Products', 'module_dir', $aosProducts);
        $this->assertAttributeEquals('AOS_Products', 'object_name', $aosProducts);
        $this->assertAttributeEquals('aos_products', 'table_name', $aosProducts);
        $this->assertAttributeEquals(true, 'new_schema', $aosProducts);
        $this->assertAttributeEquals(true, 'disable_row_level_security', $aosProducts);
        $this->assertAttributeEquals(true, 'importable', $aosProducts);
        
        // cleanup
        
        $state->popTable('aos_products');
    }

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

        $aosProducts = new AOS_Products();

        $aosProducts->name = 'test';
        $aosProducts->category = 1;
        $aosProducts->product_image = 'test img';
        $_POST['deleteAttachment'] = '1';

        $aosProducts->save();

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

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

    public function testgetCustomersPurchasedProductsQuery()
    {
        // save state
        
        $state = new SuiteCRM\StateSaver();
        $state->pushTable('aos_products');
        
        // test
        
{'fraction_non_alphanumeric': 0.12903225806451613, 'fraction_numerical': 0.0016437230326689953, 'mean_word_length': 2.467236467236467, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 63, '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': '4328541', 'n_tokens_mistral': 1442, 'n_tokens_neox': 1364, 'n_words': 253}