<commit_before><?php
/*
 * This file is part of the Dive ORM framework.
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Dive\TestSuite\Platform;

use Dive\Exception;
use Dive\Platform\PlatformException;
use Dive\Platform\PlatformInterface;
use Dive\Schema\DataTypeMapper\DataTypeMapper;
use Dive\TestSuite\TestCase;


/**
 * @author <NAME> <<EMAIL>>
 * Date: 20.12.12
 */
class PlatformTest extends TestCase
{

    /**
     * gets platform for given scheme
     *
     * @param  string $scheme
     * @param bool $addConstraintName
     * @return PlatformInterface|bool
     */
    private function createPlatform($scheme, $addConstraintName = true)
    {
        $dataTypeMapper = $this->createInstanceOrMarkTestSkipped('Schema\DataTypeMapper', 'DataTypeMapper', $scheme);
        $platform = $this->createInstanceOrMarkTestSkipped('Platform', 'Platform', $scheme, array($dataTypeMapper));
        $platform->setAddConstraintName($addConstraintName);
        return $platform;
    }


    /**
     * @dataProvider provideGetDropTableSql
     */
    public function testGetDropTableSql($database, $tableName, array $expectedArray)
    {
        $scheme = self::getSchemeFromDsn($database['dsn']);
        if (!isset($expectedArray[$scheme])) {
            $this->markTestIncomplete('Test is not implemented, yet!');
        }

        $platform = $this->createPlatform($scheme);
        $actual = $platform->getDropTableSql($tableName);
        $this->assertEquals($expectedArray[$scheme], $actual);
    }


    public function provideGetDropTableSql()
    {
        $testCases = array();

        $testCases[] = array(
            'tableName' => 'author',<commit_msg>added flag for en-/disabling constraint name to be set on adding constraints to a table - fixed test by renaming method<commit_after><?php
/*
 * This file is part of the Dive ORM framework.
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Dive\TestSuite\Platform;

use Dive\Exception;
use Dive\Platform\PlatformException;
use Dive\Platform\PlatformInterface;
use Dive\Schema\DataTypeMapper\DataTypeMapper;
use Dive\TestSuite\TestCase;


/**
 * @author <NAME> <<EMAIL>>
 * Date: 20.12.12
 */
class PlatformTest extends TestCase
{

    /**
     * gets platform for given scheme
     *
     * @param  string $scheme
     * @param bool $addConstraintName
     * @return PlatformInterface|bool
     */
    private function createPlatform($scheme, $addConstraintName = true)
    {
        $dataTypeMapper = $this->createInstanceOrMarkTestSkipped('Schema\DataTypeMapper', 'DataTypeMapper', $scheme);
        $platform = $this->createInstanceOrMarkTestSkipped('Platform', 'Platform', $scheme, array($dataTypeMapper));
        $platform->setConstraintName($addConstraintName);
        return $platform;
    }


    /**
     * @dataProvider provideGetDropTableSql
     */
    public function testGetDropTableSql($database, $tableName, array $expectedArray)
    {
        $scheme = self::getSchemeFromDsn($database['dsn']);
        if (!isset($expectedArray[$scheme])) {
            $this->markTestIncomplete('Test is not implemented, yet!');
        }

        $platform = $this->createPlatform($scheme);
        $actual = $platform->getDropTableSql($tableName);
        $this->assertEquals($expectedArray[$scheme], $actual);
    }


    public function provideGetDropTableSql()
    {
        $testCases = array();

        $testCases[] = array(
            'tableName' => 'author',
{'fraction_non_alphanumeric': 0.12469437652811736, 'fraction_numerical': 0.0032599837000814994, 'mean_word_length': 3.4148681055155876, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 31, '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': '4210777', 'n_tokens_mistral': 1029, 'n_tokens_neox': 1018, 'n_words': 248}