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
576eae09
Commit
576eae09
authored
Oct 30, 2011
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some more DBAL tests to make testsuite run on SQL Azure
parent
b8896c4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
42 deletions
+23
-42
ModifyLimitQueryTest.php
...s/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php
+19
-16
SqliteSchemaManagerTest.php
.../Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
+4
-26
No files found.
tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php
View file @
576eae09
...
...
@@ -11,7 +11,7 @@ require_once __DIR__ . '/../../TestInit.php';
class
ModifyLimitQueryTest
extends
\Doctrine\Tests\DbalFunctionalTestCase
{
private
static
$tableCreated
=
false
;
public
function
setUp
()
{
parent
::
setUp
();
...
...
@@ -20,9 +20,12 @@ class ModifyLimitQueryTest extends \Doctrine\Tests\DbalFunctionalTestCase
/* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */
$table
=
new
\Doctrine\DBAL\Schema\Table
(
"modify_limit_table"
);
$table
->
addColumn
(
'test_int'
,
'integer'
);
$table
->
setPrimaryKey
(
array
(
'test_int'
));
$table2
=
new
\Doctrine\DBAL\Schema\Table
(
"modify_limit_table2"
);
$table2
->
addColumn
(
'id'
,
'integer'
,
array
(
'autoincrement'
=>
true
));
$table2
->
addColumn
(
'test_int'
,
'integer'
);
$table2
->
setPrimaryKey
(
array
(
'id'
));
$sm
=
$this
->
_conn
->
getSchemaManager
();
$sm
->
createTable
(
$table
);
...
...
@@ -32,64 +35,64 @@ class ModifyLimitQueryTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
_conn
->
exec
(
$this
->
_conn
->
getDatabasePlatform
()
->
getTruncateTableSQL
(
'modify_limit_table'
));
$this
->
_conn
->
exec
(
$this
->
_conn
->
getDatabasePlatform
()
->
getTruncateTableSQL
(
'modify_limit_table2'
));
}
public
function
testModifyLimitQuerySimpleQuery
()
{
$this
->
_conn
->
insert
(
'modify_limit_table'
,
array
(
'test_int'
=>
1
));
$this
->
_conn
->
insert
(
'modify_limit_table'
,
array
(
'test_int'
=>
2
));
$this
->
_conn
->
insert
(
'modify_limit_table'
,
array
(
'test_int'
=>
3
));
$this
->
_conn
->
insert
(
'modify_limit_table'
,
array
(
'test_int'
=>
4
));
$sql
=
"SELECT * FROM modify_limit_table"
;
$this
->
assertLimitResult
(
array
(
1
,
2
,
3
,
4
),
$sql
,
10
,
0
);
$this
->
assertLimitResult
(
array
(
1
,
2
),
$sql
,
2
,
0
);
$this
->
assertLimitResult
(
array
(
3
,
4
),
$sql
,
2
,
2
);
}
public
function
testModifyLimitQueryJoinQuery
()
{
$this
->
_conn
->
insert
(
'modify_limit_table'
,
array
(
'test_int'
=>
1
));
$this
->
_conn
->
insert
(
'modify_limit_table'
,
array
(
'test_int'
=>
2
));
$this
->
_conn
->
insert
(
'modify_limit_table2'
,
array
(
'test_int'
=>
1
));
$this
->
_conn
->
insert
(
'modify_limit_table2'
,
array
(
'test_int'
=>
1
));
$this
->
_conn
->
insert
(
'modify_limit_table2'
,
array
(
'test_int'
=>
1
));
$this
->
_conn
->
insert
(
'modify_limit_table2'
,
array
(
'test_int'
=>
2
));
$this
->
_conn
->
insert
(
'modify_limit_table2'
,
array
(
'test_int'
=>
2
));
$sql
=
"SELECT modify_limit_table.test_int FROM modify_limit_table INNER JOIN modify_limit_table2 ON modify_limit_table.test_int = modify_limit_table2.test_int"
;
$this
->
assertLimitResult
(
array
(
1
,
1
,
1
,
2
,
2
),
$sql
,
10
,
0
);
$this
->
assertLimitResult
(
array
(
1
,
1
,
1
),
$sql
,
3
,
0
);
$this
->
assertLimitResult
(
array
(
2
,
2
),
$sql
,
2
,
3
);
}
public
function
testModifyLimitQueryOrderBy
()
{
$this
->
_conn
->
insert
(
'modify_limit_table'
,
array
(
'test_int'
=>
1
));
$this
->
_conn
->
insert
(
'modify_limit_table'
,
array
(
'test_int'
=>
2
));
$this
->
_conn
->
insert
(
'modify_limit_table'
,
array
(
'test_int'
=>
3
));
$this
->
_conn
->
insert
(
'modify_limit_table'
,
array
(
'test_int'
=>
4
));
$sql
=
"SELECT * FROM modify_limit_table ORDER BY test_int DESC"
;
$this
->
assertLimitResult
(
array
(
4
,
3
,
2
,
1
),
$sql
,
10
,
0
);
$this
->
assertLimitResult
(
array
(
4
,
3
),
$sql
,
2
,
0
);
$this
->
assertLimitResult
(
array
(
2
,
1
),
$sql
,
2
,
2
);
}
public
function
testModifyLimitQueryGroupBy
()
{
$this
->
_conn
->
insert
(
'modify_limit_table'
,
array
(
'test_int'
=>
1
));
$this
->
_conn
->
insert
(
'modify_limit_table'
,
array
(
'test_int'
=>
2
));
$this
->
_conn
->
insert
(
'modify_limit_table2'
,
array
(
'test_int'
=>
1
));
$this
->
_conn
->
insert
(
'modify_limit_table2'
,
array
(
'test_int'
=>
1
));
$this
->
_conn
->
insert
(
'modify_limit_table2'
,
array
(
'test_int'
=>
1
));
$this
->
_conn
->
insert
(
'modify_limit_table2'
,
array
(
'test_int'
=>
2
));
$this
->
_conn
->
insert
(
'modify_limit_table2'
,
array
(
'test_int'
=>
2
));
$sql
=
"SELECT modify_limit_table.test_int FROM modify_limit_table "
.
"INNER JOIN modify_limit_table2 ON modify_limit_table.test_int = modify_limit_table2.test_int "
.
"GROUP BY modify_limit_table.test_int"
;
...
...
@@ -97,7 +100,7 @@ class ModifyLimitQueryTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
assertLimitResult
(
array
(
1
),
$sql
,
1
,
0
);
$this
->
assertLimitResult
(
array
(
2
),
$sql
,
1
,
1
);
}
public
function
assertLimitResult
(
$expectedResults
,
$sql
,
$limit
,
$offset
)
{
$p
=
$this
->
_conn
->
getDatabasePlatform
();
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
View file @
576eae09
...
...
@@ -5,13 +5,13 @@ namespace Doctrine\Tests\DBAL\Functional\Schema;
use
Doctrine\DBAL\Schema
;
require_once
__DIR__
.
'/../../../TestInit.php'
;
class
SqliteSchemaManagerTest
extends
SchemaManagerFunctionalTestCase
{
/**
* SQLITE does not support databases.
*
* @expectedException \Exception
*
* @expectedException \
Doctrine\DBAL\DBAL
Exception
*/
public
function
testListDatabases
()
{
...
...
@@ -29,29 +29,7 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
}
/**
* @expectedException \Exception
*/
// This test is not correct. createSequence expects an object.
// PHPUnit wrapping the PHP error in an exception hides this but it shows up
// when the tests are run in the build (phing).
/*public function testCreateSequence()
{
$this->_sm->createSequence('seqname', 1, 1);
}*/
/**
* @expectedException \Exception
*/
// This test is not correct. createForeignKey expects an object.
// PHPUnit wrapping the PHP error in an exception hides this but it shows up
// when the tests are run in the build (phing).
/*public function testCreateForeignKey()
{
$this->_sm->createForeignKey('table', array());
}*/
/**
* @expectedException \Exception
* @expectedException \Doctrine\DBAL\DBALException
*/
public
function
testRenameTable
()
{
...
...
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