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
2479145c
Commit
2479145c
authored
Nov 05, 2014
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tear down foreign key constraint violation exception tests
parent
dcd0bc66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
4 deletions
+33
-4
ExceptionTest.php
tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php
+33
-4
No files found.
tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php
View file @
2479145c
...
...
@@ -2,6 +2,7 @@
namespace
Doctrine\Tests\DBAL\Functional
;
use
Doctrine\DBAL\Driver\ExceptionConverterDriver
;
use
Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException
;
use
Doctrine\DBAL\Schema\Table
;
class
ExceptionTest
extends
\Doctrine\Tests\DbalFunctionalTestCase
...
...
@@ -67,7 +68,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
_conn
->
insert
(
"owning_table"
,
array
(
'id'
=>
1
,
'constraint_id'
=>
1
));
$this
->
setExpectedException
(
'\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException'
);
$this
->
_conn
->
insert
(
'owning_table'
,
array
(
'id'
=>
2
,
'constraint_id'
=>
2
));
try
{
$this
->
_conn
->
insert
(
'owning_table'
,
array
(
'id'
=>
2
,
'constraint_id'
=>
2
));
}
catch
(
ForeignKeyConstraintViolationException
$exception
)
{
$this
->
tearDownForeignKeyConstraintViolationExceptionTest
();
throw
$exception
;
}
$this
->
tearDownForeignKeyConstraintViolationExceptionTest
();
}
...
...
@@ -84,7 +92,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
_conn
->
insert
(
"owning_table"
,
array
(
'id'
=>
1
,
'constraint_id'
=>
1
));
$this
->
setExpectedException
(
'\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException'
);
$this
->
_conn
->
update
(
'constraint_error_table'
,
array
(
'id'
=>
2
),
array
(
'id'
=>
1
));
try
{
$this
->
_conn
->
update
(
'constraint_error_table'
,
array
(
'id'
=>
2
),
array
(
'id'
=>
1
));
}
catch
(
ForeignKeyConstraintViolationException
$exception
)
{
$this
->
tearDownForeignKeyConstraintViolationExceptionTest
();
throw
$exception
;
}
$this
->
tearDownForeignKeyConstraintViolationExceptionTest
();
}
...
...
@@ -101,7 +116,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
_conn
->
insert
(
"owning_table"
,
array
(
'id'
=>
1
,
'constraint_id'
=>
1
));
$this
->
setExpectedException
(
'\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException'
);
$this
->
_conn
->
delete
(
'constraint_error_table'
,
array
(
'id'
=>
1
));
try
{
$this
->
_conn
->
delete
(
'constraint_error_table'
,
array
(
'id'
=>
1
));
}
catch
(
ForeignKeyConstraintViolationException
$exception
)
{
$this
->
tearDownForeignKeyConstraintViolationExceptionTest
();
throw
$exception
;
}
$this
->
tearDownForeignKeyConstraintViolationExceptionTest
();
}
...
...
@@ -120,7 +142,14 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
_conn
->
insert
(
"owning_table"
,
array
(
'id'
=>
1
,
'constraint_id'
=>
1
));
$this
->
setExpectedException
(
'\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException'
);
$this
->
_conn
->
executeUpdate
(
$platform
->
getTruncateTableSQL
(
'constraint_error_table'
));
try
{
$this
->
_conn
->
executeUpdate
(
$platform
->
getTruncateTableSQL
(
'constraint_error_table'
));
}
catch
(
ForeignKeyConstraintViolationException
$exception
)
{
$this
->
tearDownForeignKeyConstraintViolationExceptionTest
();
throw
$exception
;
}
$this
->
tearDownForeignKeyConstraintViolationExceptionTest
();
}
...
...
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