Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
expectedNodeFieldDataTable example
/** * Tests the complete node migration. */
public
function
testNodeCompleteMigration
(
)
{
$db
= \Drupal::
database
(
)
;
$this
->
assertEquals
(
$this
->
expectedNodeFieldRevisionTable
(
)
,
$db
->
select
(
'node_field_revision', 'nr'
)
->
fields
(
'nr'
)
->
orderBy
(
'vid'
)
->
orderBy
(
'langcode'
)
->
execute
(
)
->
fetchAll
(
\PDO::FETCH_ASSOC
)
)
;
$this
->
assertEquals
(
$this
->
expectedNodeFieldDataTable
(
)
,
$db
->
select
(
'node_field_data', 'nr'
)
->
fields
(
'nr'
)
->
orderBy
(
'nid'
)
->
orderBy
(
'vid'
)
->
orderBy
(
'langcode'
)
->
execute
(
)
->
fetchAll
(
\PDO::FETCH_ASSOC
)
)
;
// Now load and test each revision, including the field 'field_text_plain' // which has text reflecting the revision.
$data
=
$this
->
expectedRevisionEntityData
(
)
[
0
]
;
foreach
(
$this
->
expectedNodeFieldRevisionTable
(
)
as
$key
=>
$revision
)
{
$results
=
$this
->
nodeMigrateMapTableCount
(
'7'
)
;
$this
->
assertSame
(
0,
$results
[
'node'
]
)
;
$this
->
assertSame
(
8,
$results
[
'node_complete'
]
)
;
$db
= \Drupal::
database
(
)
;
$this
->
assertEquals
(
$this
->
expectedNodeFieldRevisionTable
(
)
,
$db
->
select
(
'node_field_revision', 'nr'
)
->
fields
(
'nr'
)
->
orderBy
(
'vid'
)
->
orderBy
(
'langcode'
)
->
execute
(
)
->
fetchAll
(
\PDO::FETCH_ASSOC
)
)
;
$this
->
assertEquals
(
$this
->
expectedNodeFieldDataTable
(
)
,
$db
->
select
(
'node_field_data', 'nr'
)
->
fields
(
'nr'
)
->
orderBy
(
'nid'
)
->
orderBy
(
'vid'
)
->
orderBy
(
'langcode'
)
->
execute
(
)
->
fetchAll
(
\PDO::FETCH_ASSOC
)
)
;
// Load and test each revision.
$data
=
$this
->
expectedRevisionEntityData
(
)
[
0
]
;
foreach
(
$this
->
expectedNodeFieldRevisionTable
(
)
as
$key
=>
$revision
)
{
$this
->
assertRevision
(
$revision
,
$data
[
$key
]
)
;
}