<commit_before><?php

namespace Doctrine\Tests;

/**
 * Base testcase class for all functional ORM testcases.
 *
 * @since 2.0
 */
class OrmFunctionalTestCase extends OrmTestCase
{
    /* The metadata cache shared between all functional tests. */
    private static $_metadataCacheImpl = null;
    /* The query cache shared between all functional tests. */
    private static $_queryCacheImpl = null;

    /* Shared connection when a TestCase is run alone (outside of it's functional suite) */
    private static $_sharedConn;
    
    /** The EntityManager for this testcase. */
    protected $_em;

    /** The SchemaTool. */
    protected $_schemaTool;

    /** The names of the model sets used in this testcase. */
    private $_usedModelSets = array();

    /** Whether the database schema has already been created. */
    private static $_tablesCreated = array();

    /** List of model sets and their classes. */
    private static $_modelSets = array(
        'cms' => array(
            'Doctrine\Tests\Models\CMS\CmsUser',
            'Doctrine\Tests\Models\CMS\CmsPhonenumber',
            'Doctrine\Tests\Models\CMS\CmsAddress',
            'Doctrine\Tests\Models\CMS\CmsGroup',
            'Doctrine\Tests\Models\CMS\CmsArticle'
        ),
        'forum' => array(),
        'company' => array(
            'Doctrine\Tests\Models\Company\CompanyPerson',
            'Doctrine\Tests\Models\Company\CompanyEmployee',
            'Doctrine\Tests\Models\Company\CompanyManager',
            'Doctrine\Tests\Models\Company\CompanyOrganization',
            'Doctrine\Tests\Models\Company\CompanyEvent',
            'Doctrine\Tests\Models\Company\CompanyAuction',
            'Doctrine\Tests\Models\Company\CompanyRaffle'
        ),
        'ecommerce' => array(
            'Doctrine\Tests\Models\ECommerce\ECommerceCart',
            'Doctrine\Tests\Models\ECommerce\ECommerceCustomer',
            'Doctrine\Tests\Models\ECommerce\ECommerceProduct',
            'Doctrine\Tests\Models\ECommerce\ECommerceShipping',
            'Doctrine\Tests\Models\ECommerce\ECommerceFeature',
            'Doctrine\Tests\Models\ECommerce\ECommerceCategory'
        ),
        'generic' => array(
            'Doctrine\Tests\Models\Generic\DateTimeModel'
        )
    );

    protected function useModelSet($setName)
    {
        $this->_usedModelSets[$setName] = true;
    }
    
    /**
     * Sweeps the database tables and clears the EntityManager.
     */
    protected function tearDown()
    {
        $conn = $this->sharedFixture['conn'];
        
        if (isset($this->_usedModelSets['cms'])) {
            $conn->executeUpdate('DROP TABLE cms_users_groups');
            $conn->executeUpdate('DROP TABLE cms_groups');
            $conn->executeUpdate('DROP TABLE cms_addresses');
            $conn->executeUpdate('DROP TABLE cms_phonenumbers');
            $conn->executeUpdate('DROP TABLE cms_articles');
            $conn->executeUpdate('DROP TABLE cms_users');
        }
        
        if (isset($this->_usedModelSets['ecommerce'])) {
            $conn->executeUpdate('DROP TABLE ecommerce_carts_products');
            $conn->executeUpdate('DROP TABLE ecommerce_products_categories');
            $conn->executeUpdate('DROP TABLE ecommerce_products_related');
            $conn->executeUpdate('DROP TABLE ecommerce_carts');
            $conn->executeUpdate('DROP TABLE ecommerce_customers');
            $conn->executeUpdate('DROP TABLE ecommerce_features');
            $conn->executeUpdate('DROP TABLE ecommerce_products');
            $conn->executeUpdate('DROP TABLE ecommerce_shippings');
            $conn->executeUpdate('UPDATE ecommerce_categories SET parent_id = NULL');
            $conn->executeUpdate('DROP TABLE ecommerce_categories');
        }
        
        if (isset($this->_usedModelSets['company'])) {
            $conn->executeUpdate('DROP TABLE company_persons_friends');
            $conn->executeUpdate('DROP TABLE company_managers');
            $conn->executeUpdate('DROP TABLE company_employees');
            $conn->executeUpdate('UPDATE company_persons SET spouse_id = NULL');
            $conn->executeUpdate('DROP TABLE company_persons');
            $conn->executeUpdate('DROP TABLE company_raffles');
            $conn->executeUpdate('DROP TABLE company_auctions');
            $conn->executeUpdate('DROP TABLE company_events');
            $conn->executeUpdate('DROP TABLE company_organizations');
        }
        
        if (isset($this->_usedModelSets['generic'])) {
            $conn->executeUpdate('DROP TABLE date_time_model');
        }
        
        $this->_em->clear();
    }

    /**<commit_msg>[2.0] Fix for fix for testsuite ;). Need to find out why the behavior is different. sqlite versions? phpunit versions?<commit_after><?php

namespace Doctrine\Tests;

/**
 * Base testcase class for all functional ORM testcases.
 *
 * @since 2.0
 */
class OrmFunctionalTestCase extends OrmTestCase
{
    /* The metadata cache shared between all functional tests. */
    private static $_metadataCacheImpl = null;
    /* The query cache shared between all functional tests. */
    private static $_queryCacheImpl = null;

    /* Shared connection when a TestCase is run alone (outside of it's functional suite) */
    private static $_sharedConn;
    
    /** The EntityManager for this testcase. */
    protected $_em;

    /** The SchemaTool. */
    protected $_schemaTool;

    /** The names of the model sets used in this testcase. */
    private $_usedModelSets = array();

    /** Whether the database schema has already been created. */
    private static $_tablesCreated = array();

    /** List of model sets and their classes. */
    private static $_modelSets = array(
        'cms' => array(
            'Doctrine\Tests\Models\CMS\CmsUser',
            'Doctrine\Tests\Models\CMS\CmsPhonenumber',
            'Doctrine\Tests\Models\CMS\CmsAddress',
            'Doctrine\Tests\Models\CMS\CmsGroup',
            'Doctrine\Tests\Models\CMS\CmsArticle'
        ),
        'forum' => array(),
        'company' => array(
            'Doctrine\Tests\Models\Company\CompanyPerson',
            'Doctrine\Tests\Models\Company\CompanyEmployee',
            'Doctrine\Tests\Models\Company\CompanyManager',
            'Doctrine\Tests\Models\Company\CompanyOrganization',
            'Doctrine\Tests\Models\Company\CompanyEvent',
            'Doctrine\Tests\Models\Company\CompanyAuction',
            'Doctrine\Tests\Models\Company\CompanyRaffle'
        ),
        'ecommerce' => array(
            'Doctrine\Tests\Models\ECommerce\ECommerceCart',
            'Doctrine\Tests\Models\ECommerce\ECommerceCustomer',
            'Doctrine\Tests\Models\ECommerce\ECommerceProduct',
            'Doctrine\Tests\Models\ECommerce\ECommerceShipping',
            'Doctrine\Tests\Models\ECommerce\ECommerceFeature',
            'Doctrine\Tests\Models\ECommerce\ECommerceCategory'
        ),
        'generic' => array(
            'Doctrine\Tests\Models\Generic\DateTimeModel'
        )
    );

    protected function useModelSet($setName)
    {
        $this->_usedModelSets[$setName] = true;
    }
    
    /**
     * Sweeps the database tables and clears the EntityManager.
     */
    protected function tearDown()
    {
        $conn = $this->sharedFixture['conn'];
        
        if (isset($this->_usedModelSets['cms'])) {
            $conn->executeUpdate('DELETE FROM cms_users_groups');
            $conn->executeUpdate('DELETE FROM cms_groups');
            $conn->executeUpdate('DELETE FROM cms_addresses');
            $conn->executeUpdate('DELETE FROM cms_phonenumbers');
            $conn->executeUpdate('DELETE FROM cms_articles');
            $conn->executeUpdate('DELETE FROM cms_users');
        }
        
        if (isset($this->_usedModelSets['ecommerce'])) {
            $conn->executeUpdate('DELETE FROM ecommerce_carts_products');
            $conn->executeUpdate('DELETE FROM ecommerce_products_categories');
            $conn->executeUpdate('DELETE FROM ecommerce_products_related');
            $conn->executeUpdate('DELETE FROM ecommerce_carts');
            $conn->executeUpdate('DELETE FROM ecommerce_customers');
            $conn->executeUpdate('DELETE FROM ecommerce_features');
            $conn->executeUpdate('DELETE FROM ecommerce_products');
            $conn->executeUpdate('DELETE FROM ecommerce_shippings');
            $conn->executeUpdate('UPDATE ecommerce_categories SET parent_id = NULL');
            $conn->executeUpdate('DELETE FROM ecommerce_categories');
        }
        
        if (isset($this->_usedModelSets['company'])) {
            $conn->executeUpdate('DELETE FROM company_persons_friends');
            $conn->executeUpdate('DELETE FROM company_managers');
            $conn->executeUpdate('DELETE FROM company_employees');
            $conn->executeUpdate('UPDATE company_persons SET spouse_id = NULL');
            $conn->executeUpdate('DELETE FROM company_persons');
            $conn->executeUpdate('DELETE FROM company_raffles');
            $conn->executeUpdate('DELETE FROM company_auctions');
            $conn->executeUpdate('DELETE FROM company_events');
            $conn->executeUpdate('DELETE FROM company_organizations');
        }
        
        if (isset($this->_usedModelSets['generic'])) {
            $conn->executeUpdate('DELETE FROM date_time_model');
        }
        
        $this->_em->clear();
    }

    /**
{'fraction_non_alphanumeric': 0.12006770337459008, 'fraction_numerical': 0.0006347191367819739, 'mean_word_length': 2.555471981948101, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 81, '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': '4931234', 'n_tokens_mistral': 2524, 'n_tokens_neox': 2482, 'n_words': 502}