Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
c01a6803
Commit
c01a6803
authored
Mar 19, 2015
by
Alex Pott
Browse files
Issue
#2403743
by quietone, rpayanm: assertion style in migration
parent
6f83b4e7
Changes
79
Hide whitespace changes
Inline
Side-by-side
core/modules/migrate_drupal/src/Tests/d6/MigrateActionConfigsTest.php
View file @
c01a6803
...
...
@@ -46,7 +46,7 @@ protected function setUp() {
*/
public
function
testActionSettings
()
{
$config
=
$this
->
config
(
'action.settings'
);
$this
->
assertIdentical
(
$config
->
get
(
'recursion_limit'
)
,
35
);
$this
->
assertIdentical
(
35
,
$config
->
get
(
'recursion_limit'
));
$this
->
assertConfigSchema
(
\
Drupal
::
service
(
'config.typed'
),
'action.settings'
,
$config
->
get
());
}
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorConfigsTest.php
View file @
c01a6803
...
...
@@ -46,13 +46,13 @@ protected function setUp() {
*/
public
function
testAggregatorSettings
()
{
$config
=
$this
->
config
(
'aggregator.settings'
);
$this
->
assertIdentical
(
$config
->
get
(
'fetcher'
)
,
'aggregator'
);
$this
->
assertIdentical
(
$config
->
get
(
'parser'
)
,
'aggregator'
);
$this
->
assertIdentical
(
$config
->
get
(
'processors'
)
,
array
(
'aggregator'
)
);
$this
->
assertIdentical
(
$config
->
get
(
'items.teaser_length'
)
,
600
);
$this
->
assertIdentical
(
$config
->
get
(
'items.allowed_html'
),
'<a> <b> <br /> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>'
);
$this
->
assertIdentical
(
$config
->
get
(
'items.expire'
)
,
9676800
);
$this
->
assertIdentical
(
$config
->
get
(
'source.list_max'
)
,
3
);
$this
->
assertIdentical
(
'aggregator'
,
$config
->
get
(
'fetcher'
));
$this
->
assertIdentical
(
'aggregator'
,
$config
->
get
(
'parser'
));
$this
->
assertIdentical
(
array
(
'aggregator'
),
$config
->
get
(
'processors'
));
$this
->
assertIdentical
(
600
,
$config
->
get
(
'items.teaser_length'
));
$this
->
assertIdentical
(
'<a> <b> <br /> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>'
,
$config
->
get
(
'items.allowed_html'
)
);
$this
->
assertIdentical
(
9676800
,
$config
->
get
(
'items.expire'
));
$this
->
assertIdentical
(
3
,
$config
->
get
(
'source.list_max'
));
$this
->
assertConfigSchema
(
\
Drupal
::
service
(
'config.typed'
),
'aggregator.settings'
,
$config
->
get
());
}
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorFeedTest.php
View file @
c01a6803
...
...
@@ -41,16 +41,16 @@ public function testAggregatorFeedImport() {
/** @var Feed $feed */
$feed
=
Feed
::
load
(
5
);
$this
->
assertNotNull
(
$feed
->
uuid
());
$this
->
assertIdentical
(
$feed
->
title
->
value
,
'Know Your Meme'
);
$this
->
assertIdentical
(
$feed
->
language
()
->
getId
()
,
'en'
);
$this
->
assertIdentical
(
$feed
->
url
->
value
,
'http://knowyourmeme.com/newsfeed.rss'
);
$this
->
assertIdentical
(
$feed
->
refresh
->
value
,
'900'
);
$this
->
assertIdentical
(
$feed
->
checked
->
value
,
'1387659487'
);
$this
->
assertIdentical
(
$feed
->
queued
->
value
,
'0'
);
$this
->
assertIdentical
(
$feed
->
link
->
value
,
'http://knowyourmeme.com'
);
$this
->
assertIdentical
(
$feed
->
description
->
value
,
'New items added to the News Feed'
);
$this
->
assertIdentical
(
$feed
->
image
->
value
,
'http://b.thumbs.redditmedia.com/harEHsUUZVajabtC.png'
);
$this
->
assertIdentical
(
$feed
->
etag
->
value
,
'"213cc1365b96c310e92053c5551f0504"'
);
$this
->
assertIdentical
(
$feed
->
modified
->
value
,
'0'
);
$this
->
assertIdentical
(
'Know Your Meme'
,
$feed
->
title
->
value
);
$this
->
assertIdentical
(
'en'
,
$feed
->
language
()
->
getId
());
$this
->
assertIdentical
(
'http://knowyourmeme.com/newsfeed.rss'
,
$feed
->
url
->
value
);
$this
->
assertIdentical
(
'900'
,
$feed
->
refresh
->
value
);
$this
->
assertIdentical
(
'1387659487'
,
$feed
->
checked
->
value
);
$this
->
assertIdentical
(
'0'
,
$feed
->
queued
->
value
);
$this
->
assertIdentical
(
'http://knowyourmeme.com'
,
$feed
->
link
->
value
);
$this
->
assertIdentical
(
'New items added to the News Feed'
,
$feed
->
description
->
value
);
$this
->
assertIdentical
(
'http://b.thumbs.redditmedia.com/harEHsUUZVajabtC.png'
,
$feed
->
image
->
value
);
$this
->
assertIdentical
(
'"213cc1365b96c310e92053c5551f0504"'
,
$feed
->
etag
->
value
);
$this
->
assertIdentical
(
'0'
,
$feed
->
modified
->
value
);
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorItemTest.php
View file @
c01a6803
...
...
@@ -60,15 +60,15 @@ protected function setUp() {
public
function
testAggregatorItem
()
{
/** @var Item $item */
$item
=
Item
::
load
(
1
);
$this
->
assertIdentical
(
$item
->
id
()
,
'1'
);
$this
->
assertIdentical
(
$item
->
getFeedId
()
,
'5'
);
$this
->
assertIdentical
(
$item
->
label
(),
'This (three) weeks in Drupal Core - January 10th 2014'
);
$this
->
assertIdentical
(
$item
->
getAuthor
()
,
'larowlan'
);
$this
->
assertIdentical
(
$item
->
getDescription
(),
"<h2 id='new'>What's new with Drupal 8?</h2>"
);
$this
->
assertIdentical
(
$item
->
getLink
(),
'https://groups.drupal.org/node/395218'
);
$this
->
assertIdentical
(
$item
->
getPostedTime
()
,
'1389297196'
);
$this
->
assertIdentical
(
$item
->
language
()
->
getId
()
,
'en'
);
$this
->
assertIdentical
(
$item
->
getGuid
(),
'395218 at https://groups.drupal.org'
);
$this
->
assertIdentical
(
'1'
,
$item
->
id
());
$this
->
assertIdentical
(
'5'
,
$item
->
getFeedId
());
$this
->
assertIdentical
(
'This (three) weeks in Drupal Core - January 10th 2014'
,
$item
->
label
()
);
$this
->
assertIdentical
(
'larowlan'
,
$item
->
getAuthor
());
$this
->
assertIdentical
(
"<h2 id='new'>What's new with Drupal 8?</h2>"
,
$item
->
getDescription
()
);
$this
->
assertIdentical
(
'https://groups.drupal.org/node/395218'
,
$item
->
getLink
()
);
$this
->
assertIdentical
(
'1389297196'
,
$item
->
getPostedTime
());
$this
->
assertIdentical
(
'en'
,
$item
->
language
()
->
getId
());
$this
->
assertIdentical
(
'395218 at https://groups.drupal.org'
,
$item
->
getGuid
()
);
}
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateBookConfigsTest.php
View file @
c01a6803
...
...
@@ -47,9 +47,9 @@ protected function setUp() {
*/
public
function
testBookSettings
()
{
$config
=
$this
->
config
(
'book.settings'
);
$this
->
assertIdentical
(
$config
->
get
(
'child_type'
)
,
'book'
);
$this
->
assertIdentical
(
$config
->
get
(
'block.navigation.mode'
)
,
'all pages'
);
$this
->
assertIdentical
(
$config
->
get
(
'allowed_types'
)
,
array
(
'book'
)
);
$this
->
assertIdentical
(
'book'
,
$config
->
get
(
'child_type'
));
$this
->
assertIdentical
(
'all pages'
,
$config
->
get
(
'block.navigation.mode'
));
$this
->
assertIdentical
(
array
(
'book'
),
$config
->
get
(
'allowed_types'
));
$this
->
assertConfigSchema
(
\
Drupal
::
service
(
'config.typed'
),
'book.settings'
,
$config
->
get
());
}
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateBookTest.php
View file @
c01a6803
...
...
@@ -55,28 +55,28 @@ protected function setUp() {
*/
public
function
testBook
()
{
$nodes
=
Node
::
loadMultiple
(
array
(
4
,
5
,
6
,
7
,
8
));
$this
->
assertIdentical
(
$nodes
[
4
]
->
book
[
'bid'
]
,
'4'
);
$this
->
assertIdentical
(
$nodes
[
4
]
->
book
[
'pid'
]
,
'0'
);
$this
->
assertIdentical
(
'4'
,
$nodes
[
4
]
->
book
[
'bid'
]);
$this
->
assertIdentical
(
'0'
,
$nodes
[
4
]
->
book
[
'pid'
]);
$this
->
assertIdentical
(
$nodes
[
5
]
->
book
[
'bid'
]
,
'4'
);
$this
->
assertIdentical
(
$nodes
[
5
]
->
book
[
'pid'
]
,
'4'
);
$this
->
assertIdentical
(
'4'
,
$nodes
[
5
]
->
book
[
'bid'
]);
$this
->
assertIdentical
(
'4'
,
$nodes
[
5
]
->
book
[
'pid'
]);
$this
->
assertIdentical
(
$nodes
[
6
]
->
book
[
'bid'
]
,
'4'
);
$this
->
assertIdentical
(
$nodes
[
6
]
->
book
[
'pid'
]
,
'5'
);
$this
->
assertIdentical
(
'4'
,
$nodes
[
6
]
->
book
[
'bid'
]);
$this
->
assertIdentical
(
'5'
,
$nodes
[
6
]
->
book
[
'pid'
]);
$this
->
assertIdentical
(
$nodes
[
7
]
->
book
[
'bid'
]
,
'4'
);
$this
->
assertIdentical
(
$nodes
[
7
]
->
book
[
'pid'
]
,
'5'
);
$this
->
assertIdentical
(
'4'
,
$nodes
[
7
]
->
book
[
'bid'
]);
$this
->
assertIdentical
(
'5'
,
$nodes
[
7
]
->
book
[
'pid'
]);
$this
->
assertIdentical
(
$nodes
[
8
]
->
book
[
'bid'
]
,
'8'
);
$this
->
assertIdentical
(
$nodes
[
8
]
->
book
[
'pid'
]
,
'0'
);
$this
->
assertIdentical
(
'8'
,
$nodes
[
8
]
->
book
[
'bid'
]);
$this
->
assertIdentical
(
'0'
,
$nodes
[
8
]
->
book
[
'pid'
]);
$tree
=
\
Drupal
::
service
(
'book.manager'
)
->
bookTreeAllData
(
4
);
$this
->
assertIdentical
(
$tree
[
'49990 Node 4 4'
][
'link'
][
'nid'
]
,
'4'
);
$this
->
assertIdentical
(
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'link'
][
'nid'
]
,
'5'
);
$this
->
assertIdentical
(
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'below'
][
'50000 Node 6 6'
][
'link'
][
'nid'
]
,
'6'
);
$this
->
assertIdentical
(
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'below'
][
'50000 Node 7 7'
][
'link'
][
'nid'
]
,
'7'
);
$this
->
assertIdentical
(
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'below'
][
'50000 Node 6 6'
][
'below'
]
,
array
()
);
$this
->
assertIdentical
(
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'below'
][
'50000 Node 7 7'
][
'below'
]
,
array
()
);
$this
->
assertIdentical
(
'4'
,
$tree
[
'49990 Node 4 4'
][
'link'
][
'nid'
]);
$this
->
assertIdentical
(
'5'
,
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'link'
][
'nid'
]);
$this
->
assertIdentical
(
'6'
,
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'below'
][
'50000 Node 6 6'
][
'link'
][
'nid'
]);
$this
->
assertIdentical
(
'7'
,
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'below'
][
'50000 Node 7 7'
][
'link'
][
'nid'
]);
$this
->
assertIdentical
(
array
(),
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'below'
][
'50000 Node 6 6'
][
'below'
]);
$this
->
assertIdentical
(
array
(),
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'below'
][
'50000 Node 7 7'
][
'below'
]);
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateCckFieldRevisionTest.php
View file @
c01a6803
...
...
@@ -76,8 +76,8 @@ protected function setUp() {
*/
public
function
testCckFieldRevision
()
{
$node
=
\
Drupal
::
entityManager
()
->
getStorage
(
'node'
)
->
loadRevision
(
2
);
$this
->
assertIdentical
(
$node
->
id
(),
'1'
,
'Node 1 loaded.'
);
$this
->
assertIdentical
(
$node
->
getRevisionId
(),
'2'
,
'Node 1 revision 2loaded.'
);
$this
->
assertIdentical
(
'1'
,
$node
->
id
(),
'Node 1 loaded.'
);
$this
->
assertIdentical
(
'2'
,
$node
->
getRevisionId
(),
'Node 1 revision 2loaded.'
);
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateCckFieldValuesTest.php
View file @
c01a6803
...
...
@@ -169,29 +169,29 @@ protected function setUp() {
public
function
testCckFields
()
{
$node
=
Node
::
load
(
1
);
$this
->
assertIdentical
(
$node
->
field_test
->
value
,
'This is a shared text field'
);
$this
->
assertIdentical
(
$node
->
field_test
->
format
,
'filtered_html'
);
$this
->
assertIdentical
(
$node
->
field_test_two
->
value
,
'10'
);
$this
->
assertIdentical
(
$node
->
field_test_two
[
1
]
->
value
,
'20'
);
$this
->
assertIdentical
(
'This is a shared text field'
,
$node
->
field_test
->
value
);
$this
->
assertIdentical
(
'filtered_html'
,
$node
->
field_test
->
format
);
$this
->
assertIdentical
(
'10'
,
$node
->
field_test_two
->
value
);
$this
->
assertIdentical
(
'20'
,
$node
->
field_test_two
[
1
]
->
value
);
$this
->
assertIdentical
(
$node
->
field_test_three
->
value
,
'42.42'
,
'Single field second value is correct.'
);
$this
->
assertIdentical
(
$node
->
field_test_integer_selectlist
[
0
]
->
value
,
'3412'
);
$this
->
assertIdentical
(
$node
->
field_test_identical1
->
value
,
'1'
,
'Integer value is correct'
);
$this
->
assertIdentical
(
$node
->
field_test_identical2
->
value
,
'1'
,
'Integer value is correct'
);
$this
->
assertIdentical
(
$node
->
field_test_
exclude
_
unset
->
value
,
'This is a field with
exclude
unset
.'
,
'Field with exclude unset is correct.'
);
$this
->
assertIdentical
(
'42.42'
,
$node
->
field_test_three
->
value
,
'Single field second value is correct.'
);
$this
->
assertIdentical
(
'3412'
,
$node
->
field_test_integer_selectlist
[
0
]
->
value
);
$this
->
assertIdentical
(
'1'
,
$node
->
field_test_identical1
->
value
,
'Integer value is correct'
);
$this
->
assertIdentical
(
'1'
,
$node
->
field_test_identical2
->
value
,
'Integer value is correct'
);
$this
->
assertIdentical
(
'This is a field with
exclude
unset
.'
,
$node
->
field_test_
exclude
_
unset
->
value
,
'Field with exclude unset is correct.'
);
// Test that link fields are migrated.
$this
->
assertIdentical
(
$node
->
field_test_link
->
uri
,
'http://drupal.org/project/drupal'
);
$this
->
assertIdentical
(
$node
->
field_test_link
->
title
,
'Drupal project page'
);
$this
->
assertIdentical
(
$node
->
field_test_link
->
options
[
'attributes'
]
,
[
'target'
=>
'_blank'
]
);
$this
->
assertIdentical
(
'http://drupal.org/project/drupal'
,
$node
->
field_test_link
->
uri
);
$this
->
assertIdentical
(
'Drupal project page'
,
$node
->
field_test_link
->
title
);
$this
->
assertIdentical
(
[
'target'
=>
'_blank'
],
$node
->
field_test_link
->
options
[
'attributes'
]);
// Test the file field meta.
$this
->
assertIdentical
(
$node
->
field_test_filefield
->
description
,
'desc'
);
$this
->
assertIdentical
(
$node
->
field_test_filefield
->
target_id
,
'5'
);
$this
->
assertIdentical
(
'desc'
,
$node
->
field_test_filefield
->
description
);
$this
->
assertIdentical
(
'5'
,
$node
->
field_test_filefield
->
target_id
);
$planet_node
=
Node
::
load
(
3
);
$this
->
assertIdentical
(
$planet_node
->
field_multivalue
->
value
,
'33.00'
);
$this
->
assertIdentical
(
$planet_node
->
field_multivalue
[
1
]
->
value
,
'44.00'
);
$this
->
assertIdentical
(
'33.00'
,
$planet_node
->
field_multivalue
->
value
);
$this
->
assertIdentical
(
'44.00'
,
$planet_node
->
field_multivalue
[
1
]
->
value
);
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityDisplayTest.php
View file @
c01a6803
...
...
@@ -30,9 +30,9 @@ class MigrateCommentVariableEntityDisplayTest extends MigrateCommentVariableDisp
public
function
testCommentEntityDisplay
()
{
foreach
(
$this
->
types
as
$type
)
{
$component
=
entity_get_display
(
'node'
,
$type
,
'default'
)
->
getComponent
(
'comment'
);
$this
->
assertIdentical
(
$component
[
'label'
]
,
'hidden'
);
$this
->
assertIdentical
(
$
com
ponent
[
'type'
]
,
'
com
ment_default'
);
$this
->
assertIdentical
(
$component
[
'weight'
]
,
20
);
$this
->
assertIdentical
(
'hidden'
,
$component
[
'label'
]);
$this
->
assertIdentical
(
'
com
ment_default'
,
$
com
ponent
[
'type'
]
);
$this
->
assertIdentical
(
20
,
$component
[
'weight'
]);
}
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityFormDisplaySubjectTest.php
View file @
c01a6803
...
...
@@ -60,8 +60,8 @@ protected function setUp() {
public
function
testCommentEntityFormDisplay
()
{
$component
=
entity_get_form_display
(
'comment'
,
'comment'
,
'default'
)
->
getComponent
(
'subject'
);
$this
->
assertIdentical
(
$component
[
'type'
],
'string_textfield'
);
$this
->
assertIdentical
(
$component
[
'weight'
]
,
10
);
$this
->
assertIdentical
(
'string_textfield'
,
$component
[
'type'
]
);
$this
->
assertIdentical
(
10
,
$component
[
'weight'
]);
$component
=
entity_get_form_display
(
'comment'
,
'comment_no_subject'
,
'default'
)
->
getComponent
(
'subject'
);
$this
->
assertNull
(
$component
);
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityFormDisplayTest.php
View file @
c01a6803
...
...
@@ -25,8 +25,8 @@ class MigrateCommentVariableEntityFormDisplayTest extends MigrateCommentVariable
public
function
testCommentEntityFormDisplay
()
{
foreach
(
$this
->
types
as
$type
)
{
$component
=
entity_get_form_display
(
'node'
,
$type
,
'default'
)
->
getComponent
(
'comment'
);
$this
->
assertIdentical
(
$
com
ponent
[
'type'
]
,
'
com
ment_default'
);
$this
->
assertIdentical
(
$component
[
'weight'
]
,
20
);
$this
->
assertIdentical
(
'
com
ment_default'
,
$
com
ponent
[
'type'
]
);
$this
->
assertIdentical
(
20
,
$component
[
'weight'
]);
}
}
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableInstanceTest.php
View file @
c01a6803
...
...
@@ -66,24 +66,24 @@ protected function setUp() {
*/
public
function
testCommentFieldInstance
()
{
$node
=
entity_create
(
'node'
,
array
(
'type'
=>
'page'
));
$this
->
assertIdentical
(
$node
->
comment
->
status
,
0
);
$this
->
assertIdentical
(
$node
->
comment
->
getFieldDefinition
()
->
getName
()
,
'comment'
);
$this
->
assertIdentical
(
0
,
$node
->
comment
->
status
);
$this
->
assertIdentical
(
'comment'
,
$node
->
comment
->
getFieldDefinition
()
->
getName
());
$settings
=
$node
->
comment
->
getFieldDefinition
()
->
getSettings
();
$this
->
assertIdentical
(
$settings
[
'default_mode'
]
,
4
);
$this
->
assertIdentical
(
$settings
[
'per_page'
]
,
50
);
$this
->
assertIdentical
(
$settings
[
'anonymous'
]
,
0
);
$this
->
assertIdentical
(
$settings
[
'form_location'
]
,
FALSE
);
$this
->
assertIdentical
(
$settings
[
'preview'
]
,
1
);
$this
->
assertIdentical
(
4
,
$settings
[
'default_mode'
]);
$this
->
assertIdentical
(
50
,
$settings
[
'per_page'
]);
$this
->
assertIdentical
(
0
,
$settings
[
'anonymous'
]);
$this
->
assertIdentical
(
FALSE
,
$settings
[
'form_location'
]);
$this
->
assertIdentical
(
1
,
$settings
[
'preview'
]);
$node
=
entity_create
(
'node'
,
array
(
'type'
=>
'story'
));
$this
->
assertIdentical
(
$node
->
comment_no_subject
->
status
,
2
);
$this
->
assertIdentical
(
$node
->
comment_no_subject
->
getFieldDefinition
()
->
getName
()
,
'comment_no_subject'
);
$this
->
assertIdentical
(
2
,
$node
->
comment_no_subject
->
status
);
$this
->
assertIdentical
(
'comment_no_subject'
,
$node
->
comment_no_subject
->
getFieldDefinition
()
->
getName
());
$settings
=
$node
->
comment_no_subject
->
getFieldDefinition
()
->
getSettings
();
$this
->
assertIdentical
(
$settings
[
'default_mode'
]
,
2
);
$this
->
assertIdentical
(
$settings
[
'per_page'
]
,
70
);
$this
->
assertIdentical
(
$settings
[
'anonymous'
]
,
1
);
$this
->
assertIdentical
(
$settings
[
'form_location'
]
,
FALSE
);
$this
->
assertIdentical
(
$settings
[
'preview'
]
,
0
);
$this
->
assertIdentical
(
2
,
$settings
[
'default_mode'
]);
$this
->
assertIdentical
(
70
,
$settings
[
'per_page'
]);
$this
->
assertIdentical
(
1
,
$settings
[
'anonymous'
]);
$this
->
assertIdentical
(
FALSE
,
$settings
[
'form_location'
]);
$this
->
assertIdentical
(
0
,
$settings
[
'preview'
]);
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateContactCategoryTest.php
View file @
c01a6803
...
...
@@ -46,22 +46,22 @@ protected function setUp() {
public
function
testContactCategory
()
{
/** @var \Drupal\contact\Entity\ContactForm $contact_form */
$contact_form
=
ContactForm
::
load
(
'website_feedback'
);
$this
->
assertIdentical
(
$contact_form
->
label
()
,
'Website feedback'
);
$this
->
assertIdentical
(
$contact_form
->
getRecipients
()
,
array
(
'admin@example.com'
)
);
$this
->
assertIdentical
(
$contact_form
->
getReply
()
,
''
);
$this
->
assertIdentical
(
$contact_form
->
getWeight
()
,
0
);
$this
->
assertIdentical
(
'Website feedback'
,
$contact_form
->
label
());
$this
->
assertIdentical
(
array
(
'admin@example.com'
),
$contact_form
->
getRecipients
());
$this
->
assertIdentical
(
''
,
$contact_form
->
getReply
());
$this
->
assertIdentical
(
0
,
$contact_form
->
getWeight
());
$contact_form
=
ContactForm
::
load
(
'some_other_category'
);
$this
->
assertIdentical
(
$contact_form
->
label
(),
'Some other category'
);
$this
->
assertIdentical
(
$contact_form
->
getRecipients
()
,
array
(
'test@example.com'
)
);
$this
->
assertIdentical
(
$contact_form
->
getReply
(),
'Thanks for contacting us, we will reply ASAP!'
);
$this
->
assertIdentical
(
$contact_form
->
getWeight
()
,
1
);
$this
->
assertIdentical
(
'Some other category'
,
$contact_form
->
label
()
);
$this
->
assertIdentical
(
array
(
'test@example.com'
),
$contact_form
->
getRecipients
());
$this
->
assertIdentical
(
'Thanks for contacting us, we will reply ASAP!'
,
$contact_form
->
getReply
()
);
$this
->
assertIdentical
(
1
,
$contact_form
->
getWeight
());
$contact_form
=
ContactForm
::
load
(
'a_category_much_longer_than_thir'
);
$this
->
assertIdentical
(
$contact_form
->
label
(),
'A category much longer than thirty two characters'
);
$this
->
assertIdentical
(
$contact_form
->
getRecipients
(),
array
(
'fortyninechars@example.com'
));
$this
->
assertIdentical
(
$contact_form
->
getReply
()
,
''
);
$this
->
assertIdentical
(
$contact_form
->
getWeight
()
,
2
);
$this
->
assertIdentical
(
'A category much longer than thirty two characters'
,
$contact_form
->
label
()
);
$this
->
assertIdentical
(
array
(
'fortyninechars@example.com'
)
,
$contact_form
->
getRecipients
()
);
$this
->
assertIdentical
(
''
,
$contact_form
->
getReply
());
$this
->
assertIdentical
(
2
,
$contact_form
->
getWeight
());
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateContactConfigsTest.php
View file @
c01a6803
...
...
@@ -56,9 +56,9 @@ protected function setUp() {
*/
public
function
testContactSettings
()
{
$config
=
$this
->
config
(
'contact.settings'
);
$this
->
assertIdentical
(
$config
->
get
(
'user_default_enabled'
)
,
true
);
$this
->
assertIdentical
(
$config
->
get
(
'flood.limit'
)
,
3
);
$this
->
assertIdentical
(
$config
->
get
(
'default_form'
)
,
'some_other_category'
);
$this
->
assertIdentical
(
true
,
$config
->
get
(
'user_default_enabled'
));
$this
->
assertIdentical
(
3
,
$config
->
get
(
'flood.limit'
));
$this
->
assertIdentical
(
'some_other_category'
,
$config
->
get
(
'default_form'
));
$this
->
assertConfigSchema
(
\
Drupal
::
service
(
'config.typed'
),
'contact.settings'
,
$config
->
get
());
}
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateDblogConfigsTest.php
View file @
c01a6803
...
...
@@ -47,7 +47,7 @@ protected function setUp() {
*/
public
function
testBookSettings
()
{
$config
=
$this
->
config
(
'dblog.settings'
);
$this
->
assertIdentical
(
$config
->
get
(
'row_limit'
)
,
1000
);
$this
->
assertIdentical
(
1000
,
$config
->
get
(
'row_limit'
));
$this
->
assertConfigSchema
(
\
Drupal
::
service
(
'config.typed'
),
'dblog.settings'
,
$config
->
get
());
}
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateFieldFormatterSettingsTest.php
View file @
c01a6803
...
...
@@ -93,23 +93,23 @@ public function testEntityDisplaySettings() {
// Can we load any entity display.
$display
=
entity_load
(
'entity_view_display'
,
'node.story.teaser'
);
$this
->
assertIdentical
(
$display
->
getComponent
(
$field_name
)
,
$expected
);
$this
->
assertIdentical
(
$expected
,
$display
->
getComponent
(
$field_name
));
// Test migrate worked with multiple bundles.
$display
=
entity_load
(
'entity_view_display'
,
'node.test_page.teaser'
);
$expected
[
'weight'
]
=
35
;
$this
->
assertIdentical
(
$display
->
getComponent
(
$field_name
)
,
$expected
);
$this
->
assertIdentical
(
$expected
,
$display
->
getComponent
(
$field_name
));
// Test RSS because that has been converted from 4 to rss.
$display
=
entity_load
(
'entity_view_display'
,
'node.story.rss'
);
$expected
[
'weight'
]
=
1
;
$this
->
assertIdentical
(
$display
->
getComponent
(
$field_name
)
,
$expected
);
$this
->
assertIdentical
(
$expected
,
$display
->
getComponent
(
$field_name
));
// Test the default format with text_default which comes from a static map.
$expected
[
'type'
]
=
'text_default'
;
$expected
[
'settings'
]
=
array
();
$display
=
entity_load
(
'entity_view_display'
,
'node.story.default'
);
$this
->
assertIdentical
(
$display
->
getComponent
(
$field_name
)
,
$expected
);
$this
->
assertIdentical
(
$expected
,
$display
->
getComponent
(
$field_name
));
// Check that we can migrate multiple fields.
$content
=
$display
->
get
(
'content'
);
...
...
@@ -127,7 +127,7 @@ public function testEntityDisplaySettings() {
'prefix_suffix'
=>
TRUE
,
);
$component
=
$display
->
getComponent
(
'field_test_two'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
$expected
[
'weight'
]
=
2
;
$expected
[
'type'
]
=
'number_decimal'
;
$expected
[
'settings'
]
=
array
(
...
...
@@ -137,14 +137,14 @@ public function testEntityDisplaySettings() {
'prefix_suffix'
=>
TRUE
,
);
$component
=
$display
->
getComponent
(
'field_test_three'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
// Test the email field formatter settings are correct.
$expected
[
'weight'
]
=
6
;
$expected
[
'type'
]
=
'email_mailto'
;
$expected
[
'settings'
]
=
array
();
$component
=
$display
->
getComponent
(
'field_test_email'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
// Test the link field formatter settings.
$expected
[
'weight'
]
=
7
;
...
...
@@ -157,79 +157,79 @@ public function testEntityDisplaySettings() {
'target'
=>
'0'
,
);
$component
=
$display
->
getComponent
(
'field_test_link'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
$expected
[
'settings'
][
'url_only'
]
=
FALSE
;
$expected
[
'settings'
][
'url_plain'
]
=
FALSE
;
$display
=
entity_load
(
'entity_view_display'
,
'node.story.teaser'
);
$component
=
$display
->
getComponent
(
'field_test_link'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
// Test the file field formatter settings.
$expected
[
'weight'
]
=
8
;
$expected
[
'type'
]
=
'file_default'
;
$expected
[
'settings'
]
=
array
();
$component
=
$display
->
getComponent
(
'field_test_filefield'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
$display
=
entity_load
(
'entity_view_display'
,
'node.story.default'
);
$expected
[
'type'
]
=
'file_url_plain'
;
$component
=
$display
->
getComponent
(
'field_test_filefield'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
// Test the image field formatter settings.
$expected
[
'weight'
]
=
9
;
$expected
[
'type'
]
=
'image'
;
$expected
[
'settings'
]
=
array
(
'image_style'
=>
''
,
'image_link'
=>
''
);
$component
=
$display
->
getComponent
(
'field_test_imagefield'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
$display
=
entity_load
(
'entity_view_display'
,
'node.story.teaser'
);
$expected
[
'settings'
][
'image_link'
]
=
'file'
;
$component
=
$display
->
getComponent
(
'field_test_imagefield'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
// Test phone field.
$expected
[
'weight'
]
=
13
;
$expected
[
'type'
]
=
'basic_string'
;
$expected
[
'settings'
]
=
array
();
$component
=
$display
->
getComponent
(
'field_test_phone'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
// Test date field.
$expected
[
'weight'
]
=
10
;
$expected
[
'type'
]
=
'datetime_default'
;
$expected
[
'settings'
]
=
array
(
'format_type'
=>
'fallback'
);
$component
=
$display
->
getComponent
(
'field_test_date'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
$display
=
entity_load
(
'entity_view_display'
,
'node.story.default'
);
$expected
[
'settings'
][
'format_type'
]
=
'long'
;
$component
=
$display
->
getComponent
(
'field_test_date'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
// Test date stamp field.
$expected
[
'weight'
]
=
11
;
$expected
[
'settings'
][
'format_type'
]
=
'fallback'
;
$component
=
$display
->
getComponent
(
'field_test_datestamp'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
$display
=
entity_load
(
'entity_view_display'
,
'node.story.teaser'
);
$expected
[
'settings'
]
=
array
(
'format_type'
=>
'medium'
);
$component
=
$display
->
getComponent
(
'field_test_datestamp'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
// Test datetime field.
$expected
[
'weight'
]
=
12
;
$expected
[
'settings'
]
=
array
(
'format_type'
=>
'short'
);
$component
=
$display
->
getComponent
(
'field_test_datetime'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
$display
=
entity_load
(
'entity_view_display'
,
'node.story.default'
);
$expected
[
'settings'
][
'format_type'
]
=
'fallback'
;
$component
=
$display
->
getComponent
(
'field_test_datetime'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
// Test a date field with a random format which should be mapped
// to datetime_default.
$display
=
entity_load
(
'entity_view_display'
,
'node.story.rss'
);
$expected
[
'settings'
][
'format_type'
]
=
'fallback'
;
$component
=
$display
->
getComponent
(
'field_test_datetime'
);
$this
->
assertIdentical
(
$
component
,
$expected
);
$this
->
assertIdentical
(
$
expected
,
$component
);
// Test that our Id map has the correct data.
$this
->
assertIdentical
(
array
(
'node'
,
'story'
,
'teaser'
,
'field_test'
),
entity_load
(
'migration'
,
'd6_field_formatter_settings'
)
->
getIdMap
()
->
lookupDestinationID
(
array
(
'story'
,
'teaser'
,
'node'
,
'field_test'
)));
}
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateFieldInstanceTest.php
View file @
c01a6803
...
...
@@ -89,14 +89,14 @@ public function testFieldInstanceSettings() {
$entity
=
entity_create
(
'node'
,
array
(
'type'
=>
'story'
));
// Test a text field.
$field
=
FieldConfig
::
load
(
'node.story.field_test'
);
$this
->
assertIdentical
(
$field
->
label
()
,
'Text Field'
);
$this
->
assertIdentical
(
'Text Field'
,
$field
->
label
());
$expected
=
array
(
'max_length'
=>
255
);
$this
->
assertIdentical
(
$field
->
getSettings
()
,
$expected
);
$this
->
assertIdentical
(
$expected
,
$field
->
getSettings
());
$this
->
assertIdentical
(
'text for default value'
,
$entity
->
field_test
->
value
);
// Test a number field.
$field
=
FieldConfig
::
load
(
'node.story.field_test_two'
);
$this
->
assertIdentical
(
$field
->
label
(),
'Integer Field'
);
$this
->
assertIdentical
(
'Integer Field'
,
$field
->
label
()
);
$expected
=
array
(
'min'
=>
10
,
'max'
=>
100
,
...
...
@@ -105,26 +105,26 @@ public function testFieldInstanceSettings() {
'unsigned'
=>
FALSE
,
'size'
=>
'normal'
,
);
$this
->
assertIdentical
(
$field
->
getSettings
()
,
$expected
);
$this
->
assertIdentical
(
$expected
,
$field
->
getSettings
());
$field
=
FieldConfig
::
load
(
'node.story.field_test_four'
);
$this
->
assertIdentical
(
$field
->
label
()
,
'Float Field'
);
$this
->
assertIdentical
(
'Float Field'
,
$field
->
label
());
$expected
=
array
(
'min'
=>
100.0
,
'max'
=>
200.0
,
'prefix'
=>
'id-'
,