Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
abc34cf0
Commit
abc34cf0
authored
Dec 29, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new test for mysql driver
parent
4650a38d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
177 additions
and
23 deletions
+177
-23
FirebirdTestCase.php
tests/DataDict/FirebirdTestCase.php
+16
-16
MysqlTestCase.php
tests/DataDict/MysqlTestCase.php
+161
-7
No files found.
tests/DataDict/FirebirdTestCase.php
View file @
abc34cf0
...
@@ -37,7 +37,7 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_UnitTestCase {
...
@@ -37,7 +37,7 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_UnitTestCase {
public
function
testGetCollationFieldDeclarationReturnsValidSql
()
{
public
function
testGetCollationFieldDeclarationReturnsValidSql
()
{
$this
->
assertEqual
(
$this
->
dataDict
->
getCollationFieldDeclaration
(
'xx'
),
'COLLATE xx'
);
$this
->
assertEqual
(
$this
->
dataDict
->
getCollationFieldDeclaration
(
'xx'
),
'COLLATE xx'
);
}
}
public
function
testGetPortable
Type
ForUnknownDbTypeThrowsException
()
{
public
function
testGetPortable
Declaration
ForUnknownDbTypeThrowsException
()
{
try
{
try
{
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'unknown'
));
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'unknown'
));
$this
->
fail
();
$this
->
fail
();
...
@@ -45,77 +45,77 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_UnitTestCase {
...
@@ -45,77 +45,77 @@ class Doctrine_DataDict_Firebird_TestCase extends Doctrine_UnitTestCase {
$this
->
pass
();
$this
->
pass
();
}
}
}
}
public
function
testGetPortable
Type
SupportsNativeDateType
()
{
public
function
testGetPortable
Declaration
SupportsNativeDateType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'date'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'date'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'date'
),
null
,
null
,
null
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'date'
),
null
,
null
,
null
));
}
}
public
function
testGetPortable
Type
SupportsNativeTimestampType
()
{
public
function
testGetPortable
Declaration
SupportsNativeTimestampType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'timestamp'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'timestamp'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'timestamp'
),
null
,
null
,
null
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'timestamp'
),
null
,
null
,
null
));
}
}
public
function
testGetPortable
Type
SupportsNativeTimeType
()
{
public
function
testGetPortable
Declaration
SupportsNativeTimeType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'time'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'time'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'time'
),
null
,
null
,
null
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'time'
),
null
,
null
,
null
));
}
}
public
function
testGetPortable
Type
SupportsNativeFloatType
()
{
public
function
testGetPortable
Declaration
SupportsNativeFloatType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'float'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'float'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'float'
),
null
,
null
,
null
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'float'
),
null
,
null
,
null
));
}
}
public
function
testGetPortable
Type
SupportsNativeDoubleType
()
{
public
function
testGetPortable
Declaration
SupportsNativeDoubleType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'double'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'double'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'float'
),
null
,
null
,
null
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'float'
),
null
,
null
,
null
));
}
}
public
function
testGetPortable
Type
SupportsNativeDoublePrecisionType
()
{
public
function
testGetPortable
Declaration
SupportsNativeDoublePrecisionType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'double precision'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'double precision'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'float'
),
null
,
null
,
null
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'float'
),
null
,
null
,
null
));
}
}
public
function
testGetPortable
Type
SupportsNativeDfloatType
()
{
public
function
testGetPortable
Declaration
SupportsNativeDfloatType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'd_float'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'd_float'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'float'
),
null
,
null
,
null
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'float'
),
null
,
null
,
null
));
}
}
public
function
testGetPortable
Type
SupportsNativeDecimalType
()
{
public
function
testGetPortable
Declaration
SupportsNativeDecimalType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'decimal'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'decimal'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'decimal'
),
null
,
null
,
null
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'decimal'
),
null
,
null
,
null
));
}
}
public
function
testGetPortable
Type
SupportsNativeNumericType
()
{
public
function
testGetPortable
Declaration
SupportsNativeNumericType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'numeric'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'numeric'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'decimal'
),
null
,
null
,
null
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'decimal'
),
null
,
null
,
null
));
}
}
public
function
testGetPortable
Type
SupportsNativeBlobType
()
{
public
function
testGetPortable
Declaration
SupportsNativeBlobType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'blob'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'blob'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'blob'
),
null
,
null
,
null
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'blob'
),
null
,
null
,
null
));
}
}
public
function
testGetPortable
Type
SupportsNativeVarcharType
()
{
public
function
testGetPortable
Declaration
SupportsNativeVarcharType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'varchar'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'varchar'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'string'
),
null
,
null
,
false
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'string'
),
null
,
null
,
false
));
}
}
public
function
testGetPortable
Type
SupportsNativeCharType
()
{
public
function
testGetPortable
Declaration
SupportsNativeCharType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'char'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'char'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'string'
),
null
,
null
,
true
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'string'
),
null
,
null
,
true
));
}
}
public
function
testGetPortable
Type
SupportsNativeCstringType
()
{
public
function
testGetPortable
Declaration
SupportsNativeCstringType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'cstring'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'cstring'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'string'
),
null
,
null
,
true
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'string'
),
null
,
null
,
true
));
}
}
public
function
testGetPortable
Type
SupportsNativeBigintType
()
{
public
function
testGetPortable
Declaration
SupportsNativeBigintType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'bigint'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'bigint'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'integer'
),
null
,
null
,
null
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'integer'
),
null
,
null
,
null
));
}
}
public
function
testGetPortable
Type
SupportsNativeQuadType
()
{
public
function
testGetPortable
Declaration
SupportsNativeQuadType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'quad'
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'quad'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'integer'
),
null
,
null
,
null
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'integer'
),
null
,
null
,
null
));
...
...
tests/DataDict/MysqlTestCase.php
View file @
abc34cf0
<?php
<?php
class
Doctrine_DataDict_Mysql_TestCase
extends
Doctrine_Driver_UnitTestCase
{
/*
public
function
__construct
()
{
* $Id$
parent
::
__construct
(
'mysql'
);
*
}
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
public
function
testGetPortableDefinitionSupportsIntegers
()
{
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
$field
=
array
(
'INT UNSIGNED'
);
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
*/
/**
* Doctrine_DataDict_Mysql_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class
Doctrine_DataDict_Mysql_TestCase
extends
Doctrine_UnitTestCase
{
public
function
testGetCharsetFieldDeclarationReturnsValidSql
()
{
$this
->
assertEqual
(
$this
->
dataDict
->
getCharsetFieldDeclaration
(
'UTF-8'
),
'CHARACTER SET UTF-8'
);
}
public
function
testGetCollationFieldDeclarationReturnsValidSql
()
{
$this
->
assertEqual
(
$this
->
dataDict
->
getCollationFieldDeclaration
(
'xx'
),
'COLLATE xx'
);
}
public
function
testGetPortableDeclarationForUnknownNativeTypeThrowsException
()
{
try
{
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'some_unknown_type'
));
$this
->
fail
();
}
catch
(
Doctrine_DataDict_Mysql_Exception
$e
)
{
$this
->
pass
();
}
}
public
function
testGetPortableDeclarationSupportsNativeIntegerTypes
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'tinyint'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'integer'
,
'boolean'
),
1
,
null
,
null
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'smallint unsigned'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'integer'
),
2
,
true
,
null
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'mediumint unsigned'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'integer'
),
3
,
true
,
null
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'int unsigned'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'integer'
),
4
,
true
,
null
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'integer unsigned'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'integer'
),
4
,
true
,
null
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'bigint unsigned'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'integer'
),
8
,
true
,
null
));
}
}
public
function
testGetPortableDeclarationSupportsNativeStringTypes
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'text'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'string'
,
'clob'
),
null
,
null
,
false
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'longtext'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'string'
,
'clob'
),
null
,
null
,
false
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'mediumtext'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'string'
,
'clob'
),
null
,
null
,
false
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'tinytext'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'string'
,
'clob'
),
null
,
null
,
false
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'char(1)'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'string'
,
'boolean'
),
1
,
null
,
true
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'varchar(1)'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'string'
,
'boolean'
),
1
,
null
,
false
));
}
public
function
testGetPortableDeclarationSupportsNativeFloatTypes
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'float'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'float'
),
null
,
null
,
null
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'real unsigned'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'float'
),
null
,
true
,
null
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'double'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'float'
),
null
,
null
,
null
));
}
public
function
testGetPortableDeclarationSupportsNativeDateType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'date'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'date'
),
null
,
null
,
null
));
}
public
function
testGetPortableDeclarationSupportsNativeDecimalTypes
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'decimal'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'decimal'
),
null
,
null
,
null
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'unknown'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'decimal'
),
null
,
null
,
null
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'numeric'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'decimal'
),
null
,
null
,
null
));
}
public
function
testGetPortableDeclarationSupportsNativeTimestampTypes
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'timestamp'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'timestamp'
),
null
,
null
,
null
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'datetime'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'timestamp'
),
null
,
null
,
null
));
}
public
function
testGetPortableDeclarationSupportsNativeYearType
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'year'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'integer'
,
'date'
),
null
,
null
,
null
));
}
public
function
testGetPortableDeclarationSupportsNativeBlobTypes
()
{
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'blob'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'blob'
),
null
,
null
,
null
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'mediumblob'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'blob'
),
null
,
null
,
null
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'tinyblob'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'blob'
),
null
,
null
,
null
));
$type
=
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
'longblob'
));
$this
->
assertEqual
(
$type
,
array
(
array
(
'blob'
),
null
,
null
,
null
));
}
public
function
testGetNativeDefinitionSupportsIntegerType
()
{
public
function
testGetNativeDefinitionSupportsIntegerType
()
{
$a
=
array
(
'type'
=>
'integer'
,
'length'
=>
20
,
'fixed'
=>
false
);
$a
=
array
(
'type'
=>
'integer'
,
'length'
=>
20
,
'fixed'
=>
false
);
...
@@ -91,4 +244,5 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_Driver_UnitTestCase {
...
@@ -91,4 +244,5 @@ class Doctrine_DataDict_Mysql_TestCase extends Doctrine_Driver_UnitTestCase {
$this
->
assertEqual
(
$this
->
dataDict
->
GetNativeDeclaration
(
$a
),
'TEXT'
);
$this
->
assertEqual
(
$this
->
dataDict
->
GetNativeDeclaration
(
$a
),
'TEXT'
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment