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
2b01d9ab
Commit
2b01d9ab
authored
Aug 21, 2014
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#657 - make unit test cases for quoting string literals easier extendable
parent
bb12840b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
8 deletions
+48
-8
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+48
-8
No files found.
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
2b01d9ab
...
@@ -871,24 +871,64 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
...
@@ -871,24 +871,64 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this
->
assertSame
(
$this
->
getStringLiteralQuoteCharacter
(),
$this
->
_platform
->
getStringLiteralQuoteCharacter
());
$this
->
assertSame
(
$this
->
getStringLiteralQuoteCharacter
(),
$this
->
_platform
->
getStringLiteralQuoteCharacter
());
}
}
public
function
testGetCommentOnColumnSQL
()
protected
function
getQuotedCommentOnColumnSQLWithoutQuoteCharacter
()
{
return
"COMMENT ON COLUMN mytable.id IS 'This is a comment'"
;
}
public
function
testGetCommentOnColumnSQLWithoutQuoteCharacter
()
{
{
$this
->
assertEquals
(
$this
->
assertEquals
(
"COMMENT ON COLUMN mytable.id IS 'This is a comment'"
,
$this
->
getQuotedCommentOnColumnSQLWithoutQuoteCharacter
()
,
$this
->
_platform
->
getCommentOnColumnSQL
(
'mytable'
,
'id'
,
'This is a comment'
)
$this
->
_platform
->
getCommentOnColumnSQL
(
'mytable'
,
'id'
,
'This is a comment'
)
);
);
}
protected
function
getQuotedCommentOnColumnSQLWithQuoteCharacter
()
{
return
"COMMENT ON COLUMN mytable.id IS 'It''s a quote !'"
;
}
public
function
testGetCommentOnColumnSQLWithQuoteCharacter
()
{
$c
=
$this
->
getStringLiteralQuoteCharacter
();
$this
->
assertEquals
(
$this
->
assertEquals
(
"COMMENT ON COLUMN mytable.id IS 'It''s a quote !'"
,
$this
->
getQuotedCommentOnColumnSQLWithQuoteCharacter
()
,
$this
->
_platform
->
getCommentOnColumnSQL
(
'mytable'
,
'id'
,
"It
'
s a quote !"
)
$this
->
_platform
->
getCommentOnColumnSQL
(
'mytable'
,
'id'
,
"It
"
.
$c
.
"
s a quote !"
)
);
);
}
}
protected
function
getQuotedStringLiteralWithoutQuoteCharacter
()
{
return
"'No quote'"
;
}
protected
function
getQuotedStringLiteralWithQuoteCharacter
()
{
return
"'It''s a quote'"
;
}
protected
function
getQuotedStringLiteralQuoteCharacter
()
{
return
"''''"
;
}
public
function
testQuoteStringLiteral
()
public
function
testQuoteStringLiteral
()
{
{
$c
=
$this
->
_platform
->
getStringLiteralQuoteCharacter
();
$c
=
$this
->
getStringLiteralQuoteCharacter
();
$this
->
assertEquals
(
$c
.
'No quote'
.
$c
,
$this
->
_platform
->
quoteStringLiteral
(
'No quote'
));
$this
->
assertEquals
(
$c
.
'It'
.
$c
.
$c
.
's a quote'
.
$c
,
$this
->
_platform
->
quoteStringLiteral
(
'It'
.
$c
.
's a quote'
));
$this
->
assertEquals
(
$this
->
assertEquals
(
$c
.
$c
.
$c
.
$c
,
$this
->
_platform
->
quoteStringLiteral
(
$c
));
$this
->
getQuotedStringLiteralWithoutQuoteCharacter
(),
$this
->
_platform
->
quoteStringLiteral
(
'No quote'
)
);
$this
->
assertEquals
(
$this
->
getQuotedStringLiteralWithQuoteCharacter
(),
$this
->
_platform
->
quoteStringLiteral
(
'It'
.
$c
.
's a quote'
)
);
$this
->
assertEquals
(
$this
->
getQuotedStringLiteralQuoteCharacter
(),
$this
->
_platform
->
quoteStringLiteral
(
$c
)
);
}
}
}
}
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