DatabasePlatformMock.php 2.12 KB
Newer Older
1 2
<?php

3
namespace Doctrine\Tests\Mocks;
romanb's avatar
romanb committed
4

jeroendedauw's avatar
jeroendedauw committed
5 6
use Doctrine\DBAL\DBALException;

7
class DatabasePlatformMock extends \Doctrine\DBAL\Platforms\AbstractPlatform
8
{
Gabriel Caruso's avatar
Gabriel Caruso committed
9 10 11
    /**
     * @var string
     */
12
    private $_sequenceNextValSql = "";
Gabriel Caruso's avatar
Gabriel Caruso committed
13 14 15 16

    /**
     * @var bool
     */
17
    private $_prefersIdentityColumns = true;
Gabriel Caruso's avatar
Gabriel Caruso committed
18 19 20 21

    /**
     * @var bool
     */
22
    private $_prefersSequences = false;
23

romanb's avatar
romanb committed
24 25 26
    /**
     * @override
     */
27 28
    public function prefersIdentityColumns()
    {
romanb's avatar
romanb committed
29 30
        return $this->_prefersIdentityColumns;
    }
31

32 33 34 35 36 37 38 39
    /**
     * @override
     */
    public function prefersSequences()
    {
        return $this->_prefersSequences;
    }

40
    /** @override */
41
    public function getSequenceNextValSQL($sequenceName)
42 43 44 45
    {
        return $this->_sequenceNextValSql;
    }

46
    /** @override */
47
    public function getBooleanTypeDeclarationSQL(array $field) {}
48

49
    /** @override */
50
    public function getIntegerTypeDeclarationSQL(array $field) {}
51 52

    /** @override */
53
    public function getBigIntTypeDeclarationSQL(array $field) {}
54 55

    /** @override */
56
    public function getSmallIntTypeDeclarationSQL(array $field) {}
57 58

    /** @override */
59
    protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) {}
60 61

    /** @override */
62
    public function getVarcharTypeDeclarationSQL(array $field) {}
63

64
    /** @override */
65
    public function getClobTypeDeclarationSQL(array $field) {}
66

romanb's avatar
romanb committed
67
    /* MOCK API */
68

romanb's avatar
romanb committed
69 70
    public function setPrefersIdentityColumns($bool)
    {
71 72 73 74 75 76
        $this->_prefersIdentityColumns = $bool;
    }

    public function setPrefersSequences($bool)
    {
        $this->_prefersSequences = $bool;
romanb's avatar
romanb committed
77
    }
78 79 80 81 82

    public function setSequenceNextValSql($sql)
    {
        $this->_sequenceNextValSql = $sql;
    }
83 84 85 86 87

    public function getName()
    {
        return 'mock';
    }
88 89
    protected function initializeDoctrineTypeMappings() {
    }
90 91
    protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
    {
92 93 94 95 96 97 98 99

    }
    /**
     * Gets the SQL Snippet used to declare a BLOB column type.
     */
    public function getBlobTypeDeclarationSQL(array $field)
    {
        throw DBALException::notSupported(__METHOD__);
100
    }
Gabriel Caruso's avatar
Gabriel Caruso committed
101
}