<commit_before><?php
/**
 * @package WorkflowDatabaseTiein
 * @subpackage Tests
 * @version //autogentag//
 * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
 * @license http://ez.no/licenses/new_bsd New BSD License
 */

ezcTestRunner::addFileToFilter( __FILE__ );

require_once 'Workflow/tests/case.php';

/**
 * @package WorkflowDatabaseTiein
 * @subpackage Tests
 */
abstract class ezcWorkflowDatabaseTieinTestCase extends ezcWorkflowTestCase
{
    protected $db;
    protected $definition;

    protected function setUp()
    {
        parent::setUp();

        try
        {
            $this->db = ezcDbInstance::get();

            $this->cleanupTables( $this->db );

            $schema = ezcDbSchema::createFromFile(
              'array',
              dirname( __FILE__ ) . '/workflow.dba'
            );

            $schema->writeToDb( $this->db );
        }
        catch ( Exception $e )
        {
            $this->markTestSkipped( 'No test database has been configured.' );
        }

        $this->definition = new ezcWorkflowDatabaseDefinitionStorage( $this->db );
    }

    protected function tearDown()
    {
        if ( $this->db !== null )
        {
            $this->cleanupTables();
        }

        $this->db = null;
        $this->definition = null;
    }

    protected function cleanupTables()
    {
        $this->db->exec( 'DROP TABLE IF EXISTS workflow;' );
        $this->db->exec( 'DROP TABLE IF EXISTS node;' );
        $this->db->exec( 'DROP TABLE IF EXISTS node_connection;' );
        $this->db->exec( 'DROP TABLE IF EXISTS variable_handler;' );
        $this->db->exec( 'DROP TABLE IF EXISTS execution;' );
        $this->db->exec( 'DROP TABLE IF EXISTS execution_state;' );
    }
}
?>
<commit_msg>- Do not create ezcWorkflowDatabaseDefinitionStorage object when connection to   the database or preparing the tables failed.<commit_after><?php
/**
 * @package WorkflowDatabaseTiein
 * @subpackage Tests
 * @version //autogentag//
 * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
 * @license http://ez.no/licenses/new_bsd New BSD License
 */

ezcTestRunner::addFileToFilter( __FILE__ );

require_once 'Workflow/tests/case.php';

/**
 * @package WorkflowDatabaseTiein
 * @subpackage Tests
 */
abstract class ezcWorkflowDatabaseTieinTestCase extends ezcWorkflowTestCase
{
    protected $db;
    protected $definition;

    protected function setUp()
    {
        parent::setUp();

        try
        {
            $this->db = ezcDbInstance::get();

            $this->cleanupTables( $this->db );

            $schema = ezcDbSchema::createFromFile(
              'array',
              dirname( __FILE__ ) . '/workflow.dba'
            );

            $schema->writeToDb( $this->db );

            $this->definition = new ezcWorkflowDatabaseDefinitionStorage( $this->db );
        }
        catch ( Exception $e )
        {
            $this->markTestSkipped( 'No test database has been configured.' );
        }
    }

    protected function tearDown()
    {
        if ( $this->db !== null )
        {
            $this->cleanupTables();
        }

        $this->db = null;
        $this->definition = null;
    }

    protected function cleanupTables()
    {
        $this->db->exec( 'DROP TABLE IF EXISTS workflow;' );
        $this->db->exec( 'DROP TABLE IF EXISTS node;' );
        $this->db->exec( 'DROP TABLE IF EXISTS node_connection;' );
        $this->db->exec( 'DROP TABLE IF EXISTS variable_handler;' );
        $this->db->exec( 'DROP TABLE IF EXISTS execution;' );
        $this->db->exec( 'DROP TABLE IF EXISTS execution_state;' );
    }
}
?>

{'fraction_non_alphanumeric': 0.13315068493150686, 'fraction_numerical': 0.004383561643835616, 'mean_word_length': 2.271505376344086, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '1147909', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1071, 'n_words': 255}