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
8d12a07a
Commit
8d12a07a
authored
Mar 24, 2012
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'PgSqlTest'
parents
9a460120
ee81b29d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
PostgreSqlSchemaManagerTest.php
...ts/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php
+34
-0
No files found.
tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php
View file @
8d12a07a
...
@@ -192,6 +192,40 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
...
@@ -192,6 +192,40 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$names
=
$this
->
_sm
->
listTableNames
();
$names
=
$this
->
_sm
->
listTableNames
();
$this
->
assertEquals
(
1
,
count
(
$names
));
$this
->
assertEquals
(
1
,
count
(
$names
));
}
}
public
function
testListForeignKeys
()
{
if
(
!
$this
->
_conn
->
getDatabasePlatform
()
->
supportsForeignKeyConstraints
())
{
$this
->
markTestSkipped
(
'Does not support foreign key constraints.'
);
}
$fkOptions
=
array
(
'SET NULL'
,
'SET DEFAULT'
,
'NO ACTION'
,
'CASCADE'
,
'RESTRICT'
);
$foreignKeys
=
array
();
$fkTable
=
$this
->
getTestTable
(
'test_create_fk1'
);
for
(
$i
=
0
;
$i
<
count
(
$fkOptions
);
$i
++
)
{
$fkTable
->
addColumn
(
"foreign_key_test
$i
"
,
'integer'
);
$foreignKeys
[]
=
new
\Doctrine\DBAL\Schema\ForeignKeyConstraint
(
array
(
"foreign_key_test
$i
"
),
'test_create_fk2'
,
array
(
'id'
),
"foreign_key_test_
$i
"
.
"_fk"
,
array
(
'onDelete'
=>
$fkOptions
[
$i
]));
}
$this
->
_sm
->
dropAndCreateTable
(
$fkTable
);
$this
->
createTestTable
(
'test_create_fk2'
);
foreach
(
$foreignKeys
as
$foreignKey
)
{
$this
->
_sm
->
createForeignKey
(
$foreignKey
,
'test_create_fk1'
);
}
$fkeys
=
$this
->
_sm
->
listTableForeignKeys
(
'test_create_fk1'
);
$this
->
assertEquals
(
count
(
$foreignKeys
),
count
(
$fkeys
),
"Table 'test_create_fk1' has to have "
.
count
(
$foreignKeys
)
.
" foreign keys."
);
for
(
$i
=
0
;
$i
<
count
(
$fkeys
);
$i
++
)
{
$this
->
assertEquals
(
array
(
"foreign_key_test
$i
"
),
array_map
(
'strtolower'
,
$fkeys
[
$i
]
->
getLocalColumns
()));
$this
->
assertEquals
(
array
(
'id'
),
array_map
(
'strtolower'
,
$fkeys
[
$i
]
->
getForeignColumns
()));
$this
->
assertEquals
(
'test_create_fk2'
,
strtolower
(
$fkeys
[
0
]
->
getForeignTableName
()));
if
(
$foreignKeys
[
$i
]
->
getOption
(
'onDelete'
)
==
'NO ACTION'
)
{
$this
->
assertFalse
(
$fkeys
[
$i
]
->
hasOption
(
'onDelete'
),
'Unexpected option: '
.
$fkeys
[
$i
]
->
getOption
(
'onDelete'
));
}
else
{
$this
->
assertEquals
(
$foreignKeys
[
$i
]
->
getOption
(
'onDelete'
),
$fkeys
[
$i
]
->
getOption
(
'onDelete'
));
}
}
}
}
}
class
MoneyType
extends
Type
class
MoneyType
extends
Type
...
...
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