Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
629003e3
Commit
629003e3
authored
Apr 21, 2015
by
catch
Browse files
Issue
#2454669
by amateescu: SQLite: Fix tests in migrate_drupal test group
parent
a336347b
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
View file @
629003e3
...
...
@@ -359,4 +359,14 @@ public function nextId($existing_id = 0) {
return
$this
->
query
(
'SELECT value FROM {sequences}'
)
->
fetchField
();
}
/**
* {@inheritdoc}
*/
public
function
getFullQualifiedTableName
(
$table
)
{
$prefix
=
$this
->
tablePrefix
(
$table
);
// Don't include the SQLite database file name as part of the table name.
return
$prefix
.
$table
;
}
}
core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php
View file @
629003e3
...
...
@@ -130,6 +130,11 @@ protected function processField($field) {
else
{
$map
=
$this
->
getFieldTypeMap
();
$field
[
'sqlite_type'
]
=
$map
[
$field
[
'type'
]
.
':'
.
$field
[
'size'
]];
// Numeric fields with a specified scale have to be stored as floats.
if
(
$field
[
'sqlite_type'
]
===
'NUMERIC'
&&
isset
(
$field
[
'scale'
]))
{
$field
[
'sqlite_type'
]
=
'FLOAT'
;
}
}
if
(
isset
(
$field
[
'type'
])
&&
$field
[
'type'
]
==
'serial'
)
{
...
...
core/modules/migrate/src/Tests/MigrateTestBase.php
View file @
629003e3
...
...
@@ -56,6 +56,9 @@ protected function setUp() {
// Simpletest uses 7 character prefixes at most so this can't cause
// collisions.
'default'
=>
$value
[
'prefix'
][
'default'
]
.
'0'
,
// Add the original simpletest prefix so SQLite can attach its database.
// @see \Drupal\Core\Database\Driver\sqlite\Connection::init()
$value
[
'prefix'
][
'default'
]
=>
$value
[
'prefix'
][
'default'
],
);
}
Database
::
addConnectionInfo
(
'migrate'
,
'default'
,
$connection_info
[
'default'
]);
...
...
core/modules/migrate_drupal/src/Tests/Table/d6/ContentFieldMultivalue.php
View file @
629003e3
...
...
@@ -27,9 +27,10 @@ public function load() {
),
'fields'
=>
array
(
'vid'
=>
array
(
'type'
=>
'
serial
'
,
'type'
=>
'
int
'
,
'not null'
=>
TRUE
,
'length'
=>
'10'
,
'default'
=>
'0'
,
'unsigned'
=>
TRUE
,
),
'nid'
=>
array
(
...
...
core/modules/migrate_drupal/src/Tests/d6.gz
View file @
629003e3
This diff is collapsed.
Click to expand it.
core/modules/migrate_drupal/src/Tests/d6/MigrateCckFieldValuesTest.php
View file @
629003e3
...
...
@@ -7,6 +7,7 @@
namespace
Drupal\migrate_drupal\Tests\d6
;
use
Drupal\Core\Database\Database
;
use
Drupal\migrate\MigrateExecutable
;
use
Drupal\node\Entity\Node
;
...
...
@@ -190,8 +191,17 @@ public function testCckFields() {
$this
->
assertIdentical
(
'5'
,
$node
->
field_test_filefield
->
target_id
);
$planet_node
=
Node
::
load
(
3
);
$this
->
assertIdentical
(
'33.00'
,
$planet_node
->
field_multivalue
->
value
);
$this
->
assertIdentical
(
'44.00'
,
$planet_node
->
field_multivalue
[
1
]
->
value
);
$value_1
=
$planet_node
->
field_multivalue
->
value
;
$value_2
=
$planet_node
->
field_multivalue
[
1
]
->
value
;
// SQLite does not support scales for float data types so we need to convert
// the value manually.
if
(
$this
->
container
->
get
(
'database'
)
->
driver
()
==
'sqlite'
)
{
$value_1
=
sprintf
(
'%01.2f'
,
$value_1
);
$value_2
=
sprintf
(
'%01.2f'
,
$value_2
);
}
$this
->
assertIdentical
(
'33.00'
,
$value_1
);
$this
->
assertIdentical
(
'44.00'
,
$value_2
);
}
}
core/modules/system/src/Tests/Database/BasicSyntaxTest.php
View file @
629003e3
...
...
@@ -125,4 +125,17 @@ function testLikeBackslash() {
->
fetchField
();
$this
->
assertIdentical
(
$num_matches
,
'1'
,
'Found 1 record.'
);
}
/**
* Tests \Drupal\Core\Database\Connection::getFullQualifiedTableName().
*/
public
function
testGetFullQualifiedTableName
()
{
$database
=
\
Drupal
::
database
();
$num_matches
=
$database
->
select
(
$database
->
getFullQualifiedTableName
(
'test'
),
't'
)
->
countQuery
()
->
execute
()
->
fetchField
();
$this
->
assertIdentical
(
$num_matches
,
'4'
,
'Found 4 records.'
);
}
}
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