Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
220
Merge Requests
220
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
629003e3
Commit
629003e3
authored
Apr 21, 2015
by
catch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Showing
7 changed files
with
280 additions
and
209 deletions
+280
-209
core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
+10
-0
core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php
core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php
+5
-0
core/modules/migrate/src/Tests/MigrateTestBase.php
core/modules/migrate/src/Tests/MigrateTestBase.php
+3
-0
core/modules/migrate_drupal/src/Tests/Table/d6/ContentFieldMultivalue.php
...rate_drupal/src/Tests/Table/d6/ContentFieldMultivalue.php
+2
-1
core/modules/migrate_drupal/src/Tests/d6.gz
core/modules/migrate_drupal/src/Tests/d6.gz
+235
-206
core/modules/migrate_drupal/src/Tests/d6/MigrateCckFieldValuesTest.php
...migrate_drupal/src/Tests/d6/MigrateCckFieldValuesTest.php
+12
-2
core/modules/system/src/Tests/Database/BasicSyntaxTest.php
core/modules/system/src/Tests/Database/BasicSyntaxTest.php
+13
-0
No files found.
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