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
03d15077
Commit
03d15077
authored
Jun 26, 2014
by
lucasvanlierop
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Used dataprovider for testConvertFromBoolean
parent
4e7e2dfe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
27 deletions
+20
-27
AbstractPostgreSqlPlatformTestCase.php
...sts/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
+20
-27
No files found.
tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
View file @
03d15077
...
...
@@ -336,35 +336,28 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa
$this
->
assertEquals
(
1
,
$platform
->
convertBooleansToDatabaseValue
(
true
));
$this
->
assertEquals
(
0
,
$platform
->
convertBooleansToDatabaseValue
(
false
));
}
public
function
testConvertFromBoolean
()
/**
* @expectedException UnexpectedValueException
* @expectedExceptionMessage Unrecognized boolean literal 'my-bool'
*/
public
function
testThrowsExceptionWithInvalidBooleanLiteral
()
{
$platform
=
$this
->
createPlatform
()
->
convertBooleansToDatabaseValue
(
"my-bool"
);
}
/**
* @dataProvider pgStringBooleanDatabaseValueProvider
*/
public
function
testConvertFromBoolean
(
$expected
,
$input
)
{
$platform
=
$this
->
createPlatform
();
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
false
));
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
'false'
));
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
'FALSE'
));
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
'f'
));
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
'F'
));
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
'no'
));
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
'NO'
));
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
'n'
));
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
'N'
));
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
'off'
));
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
'OFF'
));
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
'0'
));
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
true
));
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
'true'
));
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
'TRUE'
));
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
't'
));
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
'T'
));
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
'yes'
));
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
'YES'
));
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
'y'
));
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
'Y'
));
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
'on'
));
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
'ON'
));
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
'1'
));
if
(
$expected
===
1
)
{
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
$input
));
}
else
{
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
$input
));
}
}
/**
...
...
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