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
b8b8f85d
Commit
b8b8f85d
authored
Feb 17, 2009
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Adding basic tests for AbstractPlatform
parent
4b43a8c2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
48 deletions
+65
-48
AllTests.php
tests/Doctrine/Tests/DBAL/AllTests.php
+3
-2
AllTests.php
tests/Doctrine/Tests/DBAL/Component/AllTests.php
+0
-33
TestTest.php
tests/Doctrine/Tests/DBAL/Component/TestTest.php
+0
-13
AbstractPlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTest.php
+62
-0
No files found.
tests/Doctrine/Tests/DBAL/AllTests.php
View file @
b8b8f85d
...
@@ -24,9 +24,10 @@ class AllTests
...
@@ -24,9 +24,10 @@ class AllTests
public
static
function
suite
()
public
static
function
suite
()
{
{
$suite
=
new
\Doctrine\Tests\DbalTestSuite
(
'Doctrine Dbal'
);
$suite
=
new
\Doctrine\Tests\DbalTestSuite
(
'Doctrine DBAL'
);
$suite
->
addTestSuite
(
'Doctrine\Tests\DBAL\Platforms\AbstractPlatformTest'
);
$suite
->
addTest
(
Component\AllTests
::
suite
());
$suite
->
addTest
(
Ticket\AllTests
::
suite
());
$suite
->
addTest
(
Ticket\AllTests
::
suite
());
return
$suite
;
return
$suite
;
...
...
tests/Doctrine/Tests/DBAL/Component/AllTests.php
deleted
100644 → 0
View file @
4b43a8c2
<?php
namespace
Doctrine\Tests\DBAL\Component
;
if
(
!
defined
(
'PHPUnit_MAIN_METHOD'
))
{
define
(
'PHPUnit_MAIN_METHOD'
,
'Dbal_Component_AllTests::main'
);
}
require_once
__DIR__
.
'/../../TestInit.php'
;
// Tests
#require_once 'Dbal/Component/TestTest.php';
class
AllTests
{
public
static
function
main
()
{
\PHPUnit_TextUI_TestRunner
::
run
(
self
::
suite
());
}
public
static
function
suite
()
{
$suite
=
new
\Doctrine\Tests\DoctrineTestSuite
(
'Doctrine Dbal Component'
);
$suite
->
addTestSuite
(
'Doctrine\Tests\DBAL\Component\TestTest'
);
return
$suite
;
}
}
if
(
PHPUnit_MAIN_METHOD
==
'Dbal_Component_AllTests::main'
)
{
AllTests
::
main
();
}
\ No newline at end of file
tests/Doctrine/Tests/DBAL/Component/TestTest.php
deleted
100644 → 0
View file @
4b43a8c2
<?php
namespace
Doctrine\Tests\DBAL\Component
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
TestTest
extends
\Doctrine\Tests\DbalTestCase
{
public
function
testTest
()
{
$this
->
assertEquals
(
0
,
0
);
}
}
\ No newline at end of file
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTest.php
0 → 100644
View file @
b8b8f85d
<?php
namespace
Doctrine\Tests\DBAL\Platforms
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
AbstractPlatformTest
extends
\Doctrine\Tests\DbalTestCase
{
private
$_conn
;
public
function
setUp
()
{
$this
->
_config
=
new
\Doctrine\DBAL\Configuration
;
$this
->
_eventManager
=
new
\Doctrine\Common\EventManager
;
$options
=
array
(
'driver'
=>
'pdo_sqlite'
,
'memory'
=>
true
);
$this
->
_conn
=
\Doctrine\DBAL\DriverManager
::
getConnection
(
$options
,
$this
->
_config
,
$this
->
_eventManager
);
$this
->
_platform
=
$this
->
_conn
->
getDatabasePlatform
();
$this
->
_sm
=
$this
->
_conn
->
getSchemaManager
();
}
public
function
testGetCreateTableSql
()
{
$columns
=
array
(
'id'
=>
array
(
'type'
=>
new
\Doctrine\DBAL\Types\IntegerType
,
'autoincrement'
=>
true
),
'test'
=>
array
(
'type'
=>
new
\Doctrine\DBAL\Types\VarcharType
,
'length'
=>
255
)
);
$options
=
array
(
'primary'
=>
array
(
'id'
)
);
$sql
=
$this
->
_platform
->
getCreateTableSql
(
'test'
,
$columns
,
$options
);
$this
->
assertEquals
(
$sql
[
0
],
'CREATE TABLE test (id INTEGER AUTOINCREMENT, test VARCHAR(255))'
);
}
public
function
testGetCreateConstraintSql
()
{
$sql
=
$this
->
_platform
->
getCreateConstraintSql
(
'test'
,
'constraint_name'
,
array
(
'fields'
=>
array
(
'test'
=>
array
())));
$this
->
assertEquals
(
$sql
,
'ALTER TABLE test ADD CONSTRAINT constraint_name (test)'
);
}
public
function
testGetCreateIndexSql
()
{
$sql
=
$this
->
_platform
->
getCreateIndexSql
(
'test'
,
'index_name'
,
array
(
'type'
=>
'unique'
,
'fields'
=>
array
(
'test'
,
'test2'
)));
$this
->
assertEquals
(
$sql
,
'CREATE UNIQUE INDEX index_name ON test (test, test2)'
);
}
public
function
testGetCreateForeignKeySql
()
{
$sql
=
$this
->
_platform
->
getCreateForeignKeySql
(
'test'
,
array
(
'foreignTable'
=>
'other_table'
,
'local'
=>
'fk_name_id'
,
'foreign'
=>
'id'
));
$this
->
assertEquals
(
$sql
,
'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table(id)'
);
}
}
\ No newline at end of file
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