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
9d73f30d
Commit
9d73f30d
authored
Jun 27, 2014
by
lucasvanlierop
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Grouped all representations of boolean values into one dataprovider
parent
03d15077
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
55 deletions
+51
-55
AbstractPostgreSqlPlatformTestCase.php
...sts/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
+51
-55
No files found.
tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
View file @
9d73f30d
...
...
@@ -290,13 +290,22 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa
/**
* @group DBAL-457
* @dataProvider pgStringBooleanProvider
* @dataProvider pgBooleanProvider
*
* @param string $databaseValue
* @param string $prepareStatementValue
* @param integer $integerValue
* @param boolean $booleanValue
*/
public
function
testConvertBooleanAsLiteralStrings
(
$expected
,
$input
)
{
public
function
testConvertBooleanAsLiteralStrings
(
$databaseValue
,
$preparedStatementValue
,
$integerValue
,
$booleanValue
)
{
$platform
=
$this
->
createPlatform
();
$this
->
assertEquals
(
$
expected
,
$platform
->
convertBooleans
(
$input
));
$this
->
assertEquals
(
$
preparedStatementValue
,
$platform
->
convertBooleans
(
$databaseValue
));
}
/**
...
...
@@ -316,13 +325,23 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa
/**
* @group DBAL-630
* @dataProvider pgStringBooleanDatabaseValueProvider
* @dataProvider pgBooleanProvider
*
* @param string $databaseValue
* @param string $prepareStatementValue
* @param integer $integerValue
* @param boolean $booleanValue
*/
public
function
testConvertBooleanAsDatabaseValueStrings
(
$expected
,
$input
)
public
function
testConvertBooleanAsDatabaseValueStrings
(
$databaseValue
,
$preparedStatementValue
,
$integerValue
,
$booleanValue
)
{
$platform
=
$this
->
createPlatform
();
$this
->
assertEquals
(
$
expected
,
$platform
->
convertBooleansToDatabaseValue
(
$input
));
$this
->
assertEquals
(
$
integerValue
,
$platform
->
convertBooleansToDatabaseValue
(
$booleanValue
));
}
/**
...
...
@@ -347,17 +366,18 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa
}
/**
* @dataProvider pgStringBooleanDatabaseValueProvider
* @dataProvider pgBooleanProvider
*
* @param string $databaseValue
* @param string $prepareStatementValue
* @param integer $integerValue
* @param boolean $booleanValue
*/
public
function
testConvertFromBoolean
(
$
expected
,
$input
)
public
function
testConvertFromBoolean
(
$
databaseValue
,
$prepareStatementValue
,
$integerValue
,
$booleanValue
)
{
$platform
=
$this
->
createPlatform
();
if
(
$expected
===
1
)
{
$this
->
assertTrue
(
$platform
->
convertFromBoolean
(
$input
));
}
else
{
$this
->
assertFalse
(
$platform
->
convertFromBoolean
(
$input
));
}
$this
->
assertSame
(
$booleanValue
,
$platform
->
convertFromBoolean
(
$databaseValue
));
}
/**
...
...
@@ -583,49 +603,25 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa
* PostgreSQL boolean strings provider
* @return array
*/
public
function
pgStringBooleanProvider
()
{
return
array
(
array
(
'true'
,
true
),
array
(
'true'
,
't'
),
array
(
'true'
,
'true'
),
array
(
'true'
,
'y'
),
array
(
'true'
,
'yes'
),
array
(
'true'
,
'on'
),
array
(
'true'
,
'1'
),
array
(
'false'
,
false
),
array
(
'false'
,
'f'
),
array
(
'false'
,
'false'
),
array
(
'false'
,
'n'
),
array
(
'false'
,
'no'
),
array
(
'false'
,
'off'
),
array
(
'false'
,
'0'
),
);
}
/**
* PostgreSQL boolean strings as database values provider
* @return array
*/
public
function
pgStringBooleanDatabaseValueProvider
()
public
function
pgBooleanProvider
()
{
return
array
(
array
(
1
,
true
),
array
(
1
,
't'
),
array
(
1
,
'true'
),
array
(
1
,
'y'
),
array
(
1
,
'yes'
),
array
(
1
,
'on'
),
array
(
1
,
'1'
),
array
(
0
,
false
),
array
(
0
,
'f'
),
array
(
0
,
'false'
),
array
(
0
,
'n'
),
array
(
0
,
'no'
),
array
(
0
,
'off'
),
array
(
0
,
'0'
),
// Database value, prepared statement value, boolean integer value, boolean value.
array
(
true
,
'true'
,
1
,
true
),
array
(
't'
,
'true'
,
1
,
true
),
array
(
'true'
,
'true'
,
1
,
true
),
array
(
'y'
,
'true'
,
1
,
true
),
array
(
'yes'
,
'true'
,
1
,
true
),
array
(
'on'
,
'true'
,
1
,
true
),
array
(
'1'
,
'true'
,
1
,
true
),
array
(
false
,
'false'
,
0
,
false
),
array
(
'f'
,
'false'
,
0
,
false
),
array
(
'false'
,
'false'
,
0
,
false
),
array
(
'n'
,
'false'
,
0
,
false
),
array
(
'no'
,
'false'
,
0
,
false
),
array
(
'off'
,
'false'
,
0
,
false
),
array
(
'0'
,
'false'
,
0
,
false
),
);
}
...
...
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