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
b1d2d7c3
Commit
b1d2d7c3
authored
Feb 05, 2015
by
alexpott
Browse files
Issue
#2345833
by quietone, benjy: Convert assetEqual to assertIdentical in migrate_drupal
parent
27050971
Changes
55
Hide whitespace changes
Inline
Side-by-side
core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorFeedTest.php
View file @
b1d2d7c3
...
...
@@ -41,16 +41,16 @@ public function testAggregatorFeedImport() {
/** @var Feed $feed */
$feed
=
Feed
::
load
(
5
);
$this
->
assertNotNull
(
$feed
->
uuid
());
$this
->
assert
Equ
al
(
$feed
->
title
->
value
,
'Know Your Meme'
);
$this
->
assert
Equ
al
(
$feed
->
language
()
->
getId
(),
'en'
);
$this
->
assert
Equ
al
(
$feed
->
url
->
value
,
'http://knowyourmeme.com/newsfeed.rss'
);
$this
->
assert
Equ
al
(
$feed
->
refresh
->
value
,
900
);
$this
->
assert
Equ
al
(
$feed
->
checked
->
value
,
1387659487
);
$this
->
assert
Equ
al
(
$feed
->
queued
->
value
,
0
);
$this
->
assert
Equ
al
(
$feed
->
link
->
value
,
'http://knowyourmeme.com'
);
$this
->
assert
Equ
al
(
$feed
->
description
->
value
,
'New items added to the News Feed'
);
$this
->
assert
Equ
al
(
$feed
->
image
->
value
,
'http://b.thumbs.redditmedia.com/harEHsUUZVajabtC.png'
);
$this
->
assert
Equ
al
(
$feed
->
etag
->
value
,
'"213cc1365b96c310e92053c5551f0504"'
);
$this
->
assert
Equ
al
(
$feed
->
modified
->
value
,
0
);
$this
->
assert
Identic
al
(
$feed
->
title
->
value
,
'Know Your Meme'
);
$this
->
assert
Identic
al
(
$feed
->
language
()
->
getId
(),
'en'
);
$this
->
assert
Identic
al
(
$feed
->
url
->
value
,
'http://knowyourmeme.com/newsfeed.rss'
);
$this
->
assert
Identic
al
(
$feed
->
refresh
->
value
,
'
900
'
);
$this
->
assert
Identic
al
(
$feed
->
checked
->
value
,
'
1387659487
'
);
$this
->
assert
Identic
al
(
$feed
->
queued
->
value
,
'0'
);
$this
->
assert
Identic
al
(
$feed
->
link
->
value
,
'http://knowyourmeme.com'
);
$this
->
assert
Identic
al
(
$feed
->
description
->
value
,
'New items added to the News Feed'
);
$this
->
assert
Identic
al
(
$feed
->
image
->
value
,
'http://b.thumbs.redditmedia.com/harEHsUUZVajabtC.png'
);
$this
->
assert
Identic
al
(
$feed
->
etag
->
value
,
'"213cc1365b96c310e92053c5551f0504"'
);
$this
->
assert
Identic
al
(
$feed
->
modified
->
value
,
'0'
);
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorItemTest.php
View file @
b1d2d7c3
...
...
@@ -60,15 +60,15 @@ protected function setUp() {
public
function
testAggregatorItem
()
{
/** @var Item $item */
$item
=
Item
::
load
(
1
);
$this
->
assert
Equ
al
(
$item
->
id
(),
1
);
$this
->
assert
Equ
al
(
$item
->
getFeedId
(),
5
);
$this
->
assert
Equ
al
(
$item
->
label
(),
'This (three) weeks in Drupal Core - January 10th 2014'
);
$this
->
assert
Equ
al
(
$item
->
getAuthor
(),
'larowlan'
);
$this
->
assert
Equ
al
(
$item
->
getDescription
(),
"<h2 id='new'>What's new with Drupal 8?</h2>"
);
$this
->
assert
Equ
al
(
$item
->
getLink
(),
'https://groups.drupal.org/node/395218'
);
$this
->
assert
Equ
al
(
$item
->
getPostedTime
(),
1389297196
);
$this
->
assert
Equ
al
(
$item
->
language
()
->
getId
(),
'en'
);
$this
->
assert
Equ
al
(
$item
->
getGuid
(),
'395218 at https://groups.drupal.org'
);
$this
->
assert
Identic
al
(
$item
->
id
(),
'1'
);
$this
->
assert
Identic
al
(
$item
->
getFeedId
(),
'5'
);
$this
->
assert
Identic
al
(
$item
->
label
(),
'This (three) weeks in Drupal Core - January 10th 2014'
);
$this
->
assert
Identic
al
(
$item
->
getAuthor
(),
'larowlan'
);
$this
->
assert
Identic
al
(
$item
->
getDescription
(),
"<h2 id='new'>What's new with Drupal 8?</h2>"
);
$this
->
assert
Identic
al
(
$item
->
getLink
(),
'https://groups.drupal.org/node/395218'
);
$this
->
assert
Identic
al
(
$item
->
getPostedTime
(),
'
1389297196
'
);
$this
->
assert
Identic
al
(
$item
->
language
()
->
getId
(),
'en'
);
$this
->
assert
Identic
al
(
$item
->
getGuid
(),
'395218 at https://groups.drupal.org'
);
}
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateBlockContentTest.php
View file @
b1d2d7c3
...
...
@@ -56,20 +56,20 @@ protected function setUp() {
public
function
testBlockMigration
()
{
/** @var BlockContent $block */
$block
=
entity_load
(
'block_content'
,
1
);
$this
->
assert
Equ
al
(
'My block 1'
,
$block
->
label
());
$this
->
assert
Equal
(
1
,
$block
->
getRevisionId
());
$this
->
assert
Identic
al
(
'My block 1'
,
$block
->
label
());
$this
->
assert
Identical
(
'1'
,
$block
->
getRevisionId
());
$this
->
assertTrue
(
REQUEST_TIME
<=
$block
->
getChangedTime
()
&&
$block
->
getChangedTime
()
<=
time
());
$this
->
assert
Equ
al
(
'en'
,
$block
->
language
()
->
getId
());
$this
->
assert
Equ
al
(
'<h3>My first custom block body</h3>'
,
$block
->
body
->
value
);
$this
->
assert
Equ
al
(
'full_html'
,
$block
->
body
->
format
);
$this
->
assert
Identic
al
(
'en'
,
$block
->
language
()
->
getId
());
$this
->
assert
Identic
al
(
'<h3>My first custom block body</h3>'
,
$block
->
body
->
value
);
$this
->
assert
Identic
al
(
'full_html'
,
$block
->
body
->
format
);
$block
=
entity_load
(
'block_content'
,
2
);
$this
->
assert
Equ
al
(
'My block 2'
,
$block
->
label
());
$this
->
assert
Equal
(
2
,
$block
->
getRevisionId
());
$this
->
assert
Identic
al
(
'My block 2'
,
$block
->
label
());
$this
->
assert
Identical
(
'2'
,
$block
->
getRevisionId
());
$this
->
assertTrue
(
REQUEST_TIME
<=
$block
->
getChangedTime
()
&&
$block
->
getChangedTime
()
<=
time
());
$this
->
assert
Equ
al
(
'en'
,
$block
->
language
()
->
getId
());
$this
->
assert
Equ
al
(
'<h3>My second custom block body</h3>'
,
$block
->
body
->
value
);
$this
->
assert
Equ
al
(
'full_html'
,
$block
->
body
->
format
);
$this
->
assert
Identic
al
(
'en'
,
$block
->
language
()
->
getId
());
$this
->
assert
Identic
al
(
'<h3>My second custom block body</h3>'
,
$block
->
body
->
value
);
$this
->
assert
Identic
al
(
'full_html'
,
$block
->
body
->
format
);
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateBlockTest.php
View file @
b1d2d7c3
...
...
@@ -87,98 +87,98 @@ protected function setUp() {
*/
public
function
testBlockMigration
()
{
$blocks
=
Block
::
loadMultiple
();
$this
->
assert
Equ
al
(
count
(
$blocks
),
10
);
$this
->
assert
Identic
al
(
count
(
$blocks
),
10
);
// User blocks
$test_block_user
=
$blocks
[
'user'
];
$this
->
assertNotNull
(
$test_block_user
);
$this
->
assert
Equ
al
(
'sidebar_first'
,
$test_block_user
->
getRegion
());
$this
->
assert
Equ
al
(
'bartik'
,
$test_block_user
->
getTheme
());
$this
->
assert
Identic
al
(
'sidebar_first'
,
$test_block_user
->
getRegion
());
$this
->
assert
Identic
al
(
'bartik'
,
$test_block_user
->
getTheme
());
$visibility
=
$test_block_user
->
getVisibility
();
$this
->
assertTrue
(
empty
(
$visibility
[
'request_path'
][
'pages'
]));
$this
->
assert
Equ
al
(
0
,
$test_block_user
->
getWeight
());
$this
->
assert
Identic
al
(
0
,
$test_block_user
->
getWeight
());
$test_block_user_1
=
$blocks
[
'user_1'
];
$this
->
assertNotNull
(
$test_block_user_1
);
$this
->
assert
Equ
al
(
'sidebar_first'
,
$test_block_user_1
->
getRegion
());
$this
->
assert
Equ
al
(
'bartik'
,
$test_block_user_1
->
getTheme
());
$this
->
assert
Identic
al
(
'sidebar_first'
,
$test_block_user_1
->
getRegion
());
$this
->
assert
Identic
al
(
'bartik'
,
$test_block_user_1
->
getTheme
());
$visibility
=
$test_block_user_1
->
getVisibility
();
$this
->
assertTrue
(
empty
(
$visibility
[
'request_path'
][
'pages'
]));
$this
->
assert
Equ
al
(
0
,
$test_block_user_1
->
getWeight
());
$this
->
assert
Identic
al
(
0
,
$test_block_user_1
->
getWeight
());
$test_block_user_2
=
$blocks
[
'user_2'
];
$this
->
assertNotNull
(
$test_block_user_2
);
$this
->
assert
Equ
al
(
'sidebar_second'
,
$test_block_user_2
->
getRegion
());
$this
->
assert
Equ
al
(
'bartik'
,
$test_block_user_2
->
getTheme
());
$this
->
assert
Identic
al
(
'sidebar_second'
,
$test_block_user_2
->
getRegion
());
$this
->
assert
Identic
al
(
'bartik'
,
$test_block_user_2
->
getTheme
());
$visibility
=
$test_block_user_2
->
getVisibility
();
$this
->
assert
Equ
al
(
$visibility
[
'user_role'
][
'id'
],
'user_role'
);
$this
->
assert
Identic
al
(
$visibility
[
'user_role'
][
'id'
],
'user_role'
);
$roles
=
array
();
$roles
[
'authenticated'
]
=
'authenticated'
;
$this
->
assert
Equ
al
(
$visibility
[
'user_role'
][
'roles'
],
$roles
);
$this
->
assert
Identic
al
(
$visibility
[
'user_role'
][
'roles'
],
$roles
);
$this
->
assertFalse
(
$visibility
[
'user_role'
][
'negate'
]);
$this
->
assert
Equ
al
(
-
9
,
$test_block_user_2
->
getWeight
());
$this
->
assert
Identic
al
(
-
9
,
$test_block_user_2
->
getWeight
());
$test_block_user_3
=
$blocks
[
'user_3'
];
$this
->
assertNotNull
(
$test_block_user_3
);
$this
->
assert
Equ
al
(
'sidebar_second'
,
$test_block_user_3
->
getRegion
());
$this
->
assert
Equ
al
(
'bartik'
,
$test_block_user_3
->
getTheme
());
$this
->
assert
Identic
al
(
'sidebar_second'
,
$test_block_user_3
->
getRegion
());
$this
->
assert
Identic
al
(
'bartik'
,
$test_block_user_3
->
getTheme
());
$visibility
=
$test_block_user_3
->
getVisibility
();
$this
->
assert
Equ
al
(
$visibility
[
'user_role'
][
'id'
],
'user_role'
);
$this
->
assert
Identic
al
(
$visibility
[
'user_role'
][
'id'
],
'user_role'
);
$roles
=
array
();
$roles
[
'migrate_test_role_1'
]
=
'migrate_test_role_1'
;
$this
->
assert
Equ
al
(
$visibility
[
'user_role'
][
'roles'
],
$roles
);
$this
->
assert
Identic
al
(
$visibility
[
'user_role'
][
'roles'
],
$roles
);
$this
->
assertFalse
(
$visibility
[
'user_role'
][
'negate'
]);
$this
->
assert
Equ
al
(
-
6
,
$test_block_user_3
->
getWeight
());
$this
->
assert
Identic
al
(
-
6
,
$test_block_user_3
->
getWeight
());
// Check system block
$test_block_system
=
$blocks
[
'system'
];
$this
->
assertNotNull
(
$test_block_system
);
$this
->
assert
Equ
al
(
'footer'
,
$test_block_system
->
getRegion
());
$this
->
assert
Equ
al
(
'bartik'
,
$test_block_system
->
getTheme
());
$this
->
assert
Identic
al
(
'footer'
,
$test_block_system
->
getRegion
());
$this
->
assert
Identic
al
(
'bartik'
,
$test_block_system
->
getTheme
());
$visibility
=
$test_block_system
->
getVisibility
();
$this
->
assertTrue
(
empty
(
$visibility
[
'request_path'
][
'pages'
]));
$this
->
assert
Equ
al
(
-
5
,
$test_block_system
->
getWeight
());
$this
->
assert
Identic
al
(
-
5
,
$test_block_system
->
getWeight
());
// Check menu blocks
$test_block_menu
=
$blocks
[
'menu'
];
$this
->
assertNotNull
(
$test_block_menu
);
$this
->
assert
Equ
al
(
'header'
,
$test_block_menu
->
getRegion
());
$this
->
assert
Equ
al
(
'bartik'
,
$test_block_menu
->
getTheme
());
$this
->
assert
Identic
al
(
'header'
,
$test_block_menu
->
getRegion
());
$this
->
assert
Identic
al
(
'bartik'
,
$test_block_menu
->
getTheme
());
$visibility
=
$test_block_menu
->
getVisibility
();
$this
->
assertTrue
(
empty
(
$visibility
[
'request_path'
][
'pages'
]));
$this
->
assert
Equ
al
(
-
5
,
$test_block_menu
->
getWeight
());
$this
->
assert
Identic
al
(
-
5
,
$test_block_menu
->
getWeight
());
// Check custom blocks
$test_block_block
=
$blocks
[
'block'
];
$this
->
assertNotNull
(
$test_block_block
);
$this
->
assert
Equ
al
(
'content'
,
$test_block_block
->
getRegion
());
$this
->
assert
Equ
al
(
'bartik'
,
$test_block_block
->
getTheme
());
$this
->
assert
Identic
al
(
'content'
,
$test_block_block
->
getRegion
());
$this
->
assert
Identic
al
(
'bartik'
,
$test_block_block
->
getTheme
());
$visibility
=
$test_block_block
->
getVisibility
();
$this
->
assert
Equ
al
(
$visibility
[
'request_path'
][
'pages'
],
'<front>'
);
$this
->
assert
Equ
al
(
0
,
$test_block_block
->
getWeight
());
$this
->
assert
Identic
al
(
$visibility
[
'request_path'
][
'pages'
],
'<front>'
);
$this
->
assert
Identic
al
(
0
,
$test_block_block
->
getWeight
());
$test_block_block_1
=
$blocks
[
'block_1'
];
$this
->
assertNotNull
(
$test_block_block_1
);
$this
->
assert
Equ
al
(
'right'
,
$test_block_block_1
->
getRegion
());
$this
->
assert
Equ
al
(
'bluemarine'
,
$test_block_block_1
->
getTheme
());
$this
->
assert
Identic
al
(
'right'
,
$test_block_block_1
->
getRegion
());
$this
->
assert
Identic
al
(
'bluemarine'
,
$test_block_block_1
->
getTheme
());
$visibility
=
$test_block_block_1
->
getVisibility
();
$this
->
assert
Equ
al
(
$visibility
[
'request_path'
][
'pages'
],
'node'
);
$this
->
assert
Equ
al
(
-
4
,
$test_block_block_1
->
getWeight
());
$this
->
assert
Identic
al
(
$visibility
[
'request_path'
][
'pages'
],
'node'
);
$this
->
assert
Identic
al
(
-
4
,
$test_block_block_1
->
getWeight
());
$test_block_block_2
=
$blocks
[
'block_2'
];
$this
->
assertNotNull
(
$test_block_block_2
);
$this
->
assert
Equ
al
(
'right'
,
$test_block_block_2
->
getRegion
());
$this
->
assert
Equ
al
(
'test_theme'
,
$test_block_block_2
->
getTheme
());
$this
->
assert
Identic
al
(
'right'
,
$test_block_block_2
->
getRegion
());
$this
->
assert
Identic
al
(
'test_theme'
,
$test_block_block_2
->
getTheme
());
$visibility
=
$test_block_block_2
->
getVisibility
();
$this
->
assertTrue
(
empty
(
$visibility
[
'request_path'
][
'pages'
]));
$this
->
assert
Equ
al
(
-
7
,
$test_block_block_2
->
getWeight
());
$this
->
assert
Identic
al
(
-
7
,
$test_block_block_2
->
getWeight
());
$test_block_block_3
=
$blocks
[
'block_3'
];
$this
->
assertNotNull
(
$test_block_block_3
);
$this
->
assert
Equ
al
(
'left'
,
$test_block_block_3
->
getRegion
());
$this
->
assert
Equ
al
(
'test_theme'
,
$test_block_block_3
->
getTheme
());
$this
->
assert
Identic
al
(
'left'
,
$test_block_block_3
->
getRegion
());
$this
->
assert
Identic
al
(
'test_theme'
,
$test_block_block_3
->
getTheme
());
$visibility
=
$test_block_block_3
->
getVisibility
();
$this
->
assertTrue
(
empty
(
$visibility
[
'request_path'
][
'pages'
]));
$this
->
assert
Equ
al
(
-
2
,
$test_block_block_3
->
getWeight
());
$this
->
assert
Identic
al
(
-
2
,
$test_block_block_3
->
getWeight
());
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateBookTest.php
View file @
b1d2d7c3
...
...
@@ -55,26 +55,26 @@ protected function setUp() {
*/
public
function
testBook
()
{
$nodes
=
Node
::
loadMultiple
(
array
(
4
,
5
,
6
,
7
,
8
));
$this
->
assert
Equ
al
(
$nodes
[
4
]
->
book
[
'bid'
],
4
);
$this
->
assert
Equ
al
(
$nodes
[
4
]
->
book
[
'pid'
],
0
);
$this
->
assert
Identic
al
(
$nodes
[
4
]
->
book
[
'bid'
],
'4'
);
$this
->
assert
Identic
al
(
$nodes
[
4
]
->
book
[
'pid'
],
'0'
);
$this
->
assert
Equ
al
(
$nodes
[
5
]
->
book
[
'bid'
],
4
);
$this
->
assert
Equ
al
(
$nodes
[
5
]
->
book
[
'pid'
],
4
);
$this
->
assert
Identic
al
(
$nodes
[
5
]
->
book
[
'bid'
],
'4'
);
$this
->
assert
Identic
al
(
$nodes
[
5
]
->
book
[
'pid'
],
'4'
);
$this
->
assert
Equ
al
(
$nodes
[
6
]
->
book
[
'bid'
],
4
);
$this
->
assert
Equ
al
(
$nodes
[
6
]
->
book
[
'pid'
],
5
);
$this
->
assert
Identic
al
(
$nodes
[
6
]
->
book
[
'bid'
],
'4'
);
$this
->
assert
Identic
al
(
$nodes
[
6
]
->
book
[
'pid'
],
'5'
);
$this
->
assert
Equ
al
(
$nodes
[
7
]
->
book
[
'bid'
],
4
);
$this
->
assert
Equ
al
(
$nodes
[
7
]
->
book
[
'pid'
],
5
);
$this
->
assert
Identic
al
(
$nodes
[
7
]
->
book
[
'bid'
],
'4'
);
$this
->
assert
Identic
al
(
$nodes
[
7
]
->
book
[
'pid'
],
'5'
);
$this
->
assert
Equ
al
(
$nodes
[
8
]
->
book
[
'bid'
],
8
);
$this
->
assert
Equ
al
(
$nodes
[
8
]
->
book
[
'pid'
],
0
);
$this
->
assert
Identic
al
(
$nodes
[
8
]
->
book
[
'bid'
],
'8'
);
$this
->
assert
Identic
al
(
$nodes
[
8
]
->
book
[
'pid'
],
'0'
);
$tree
=
\
Drupal
::
service
(
'book.manager'
)
->
bookTreeAllData
(
4
);
$this
->
assert
Equ
al
(
$tree
[
'49990 Node 4 4'
][
'link'
][
'nid'
],
4
);
$this
->
assert
Equ
al
(
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'link'
][
'nid'
],
5
);
$this
->
assert
Equ
al
(
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'below'
][
'50000 Node 6 6'
][
'link'
][
'nid'
],
6
);
$this
->
assert
Equ
al
(
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'below'
][
'50000 Node 7 7'
][
'link'
][
'nid'
],
7
);
$this
->
assert
Identic
al
(
$tree
[
'49990 Node 4 4'
][
'link'
][
'nid'
],
'4'
);
$this
->
assert
Identic
al
(
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'link'
][
'nid'
],
'5'
);
$this
->
assert
Identic
al
(
$tree
[
'49990 Node 4 4'
][
'below'
][
'50000 Node 5 5'
][
'below'
][
'50000 Node 6 6'
][
'link'
][
'nid'
],
'6'
);
$this
->
assert
Identic
al
(
$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
());
}
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateCckFieldRevisionTest.php
View file @
b1d2d7c3
...
...
@@ -76,8 +76,8 @@ protected function setUp() {
*/
public
function
testCckFieldRevision
()
{
$node
=
\
Drupal
::
entityManager
()
->
getStorage
(
'node'
)
->
loadRevision
(
2
);
$this
->
assert
Equ
al
(
$node
->
id
(),
1
,
'Node 1 loaded.'
);
$this
->
assert
Equ
al
(
$node
->
getRevisionId
(),
2
,
'Node 1 revision 2loaded.'
);
$this
->
assert
Identic
al
(
$node
->
id
(),
'1'
,
'Node 1 loaded.'
);
$this
->
assert
Identic
al
(
$node
->
getRevisionId
(),
'2'
,
'Node 1 revision 2loaded.'
);
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateCckFieldValuesTest.php
View file @
b1d2d7c3
...
...
@@ -84,7 +84,9 @@ protected function setUp() {
entity_create
(
'field_storage_config'
,
array
(
'entity_type'
=>
'node'
,
'field_name'
=>
'field_multivalue'
,
'type'
=>
'integer'
,
'type'
=>
'decimal'
,
'precision'
=>
'10'
,
'scale'
=>
'2'
,
'cardinality'
=>
-
1
,
))
->
save
();
entity_create
(
'field_config'
,
array
(
...
...
@@ -167,16 +169,16 @@ protected function setUp() {
public
function
testCckFields
()
{
$node
=
Node
::
load
(
1
);
$this
->
assert
Equ
al
(
$node
->
field_test
->
value
,
'This is a shared text field'
);
$this
->
assert
Equ
al
(
$node
->
field_test
->
format
,
'filtered_html'
);
$this
->
assert
Equ
al
(
$node
->
field_test_two
->
value
,
10
);
$this
->
assert
Equ
al
(
$node
->
field_test_two
[
1
]
->
value
,
20
);
$this
->
assert
Identic
al
(
$node
->
field_test
->
value
,
'This is a shared text field'
);
$this
->
assert
Identic
al
(
$node
->
field_test
->
format
,
'filtered_html'
);
$this
->
assert
Identic
al
(
$node
->
field_test_two
->
value
,
'
10
'
);
$this
->
assert
Identic
al
(
$node
->
field_test_two
[
1
]
->
value
,
'
20
'
);
$this
->
assert
Equ
al
(
$node
->
field_test_three
->
value
,
'42.42'
,
'Single field second value is correct.'
);
$this
->
assert
Equ
al
(
$node
->
field_test_integer_selectlist
[
0
]
->
value
,
'3412'
);
$this
->
assert
Equ
al
(
$node
->
field_test_identical1
->
value
,
'1'
,
'Integer value is correct'
);
$this
->
assert
Equ
al
(
$node
->
field_test_identical2
->
value
,
'1'
,
'Integer value is correct'
);
$this
->
assert
Equ
al
(
$node
->
field_test_exclude_unset
->
value
,
'This is a field with exclude unset.'
,
'Field with exclude unset is correct.'
);
$this
->
assert
Identic
al
(
$node
->
field_test_three
->
value
,
'42.42'
,
'Single field second value is correct.'
);
$this
->
assert
Identic
al
(
$node
->
field_test_integer_selectlist
[
0
]
->
value
,
'3412'
);
$this
->
assert
Identic
al
(
$node
->
field_test_identical1
->
value
,
'1'
,
'Integer value is correct'
);
$this
->
assert
Identic
al
(
$node
->
field_test_identical2
->
value
,
'1'
,
'Integer value is correct'
);
$this
->
assert
Identic
al
(
$node
->
field_test_exclude_unset
->
value
,
'This is a field with exclude unset.'
,
'Field with exclude unset is correct.'
);
// Test that link fields are migrated.
$this
->
assertIdentical
(
$node
->
field_test_link
->
uri
,
'http://drupal.org/project/drupal'
);
...
...
@@ -188,8 +190,8 @@ public function testCckFields() {
$this
->
assertIdentical
(
$node
->
field_test_filefield
->
target_id
,
'5'
);
$planet_node
=
Node
::
load
(
3
);
$this
->
assert
Equ
al
(
$planet_node
->
field_multivalue
->
value
,
33
);
$this
->
assert
Equ
al
(
$planet_node
->
field_multivalue
[
1
]
->
value
,
44
);
$this
->
assert
Identic
al
(
$planet_node
->
field_multivalue
->
value
,
'
33
.00'
);
$this
->
assert
Identic
al
(
$planet_node
->
field_multivalue
[
1
]
->
value
,
'
44
.00'
);
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php
View file @
b1d2d7c3
...
...
@@ -75,21 +75,21 @@ protected function setUp() {
public
function
testComments
()
{
/** @var \Drupal\comment\CommentInterface $comment */
$comment
=
entity_load
(
'comment'
,
1
);
$this
->
assert
Equ
al
(
'The first comment.'
,
$comment
->
getSubject
());
$this
->
assert
Equ
al
(
'The first comment body.'
,
$comment
->
comment_body
->
value
);
$this
->
assert
Equ
al
(
'filtered_html'
,
$comment
->
comment_body
->
format
);
$this
->
assert
Equal
(
0
,
$comment
->
pid
->
target_id
);
$this
->
assert
Equal
(
1
,
$comment
->
getCommentedEntityId
());
$this
->
assert
Equ
al
(
'node'
,
$comment
->
getCommentedEntityTypeId
());
$this
->
assert
Equ
al
(
'en'
,
$comment
->
language
()
->
getId
());
$this
->
assert
Equ
al
(
'comment_no_subject'
,
$comment
->
getTypeId
());
$this
->
assert
Identic
al
(
'The first comment.'
,
$comment
->
getSubject
());
$this
->
assert
Identic
al
(
'The first comment body.'
,
$comment
->
comment_body
->
value
);
$this
->
assert
Identic
al
(
'filtered_html'
,
$comment
->
comment_body
->
format
);
$this
->
assert
Identical
(
'0'
,
$comment
->
pid
->
target_id
);
$this
->
assert
Identical
(
'1'
,
$comment
->
getCommentedEntityId
());
$this
->
assert
Identic
al
(
'node'
,
$comment
->
getCommentedEntityTypeId
());
$this
->
assert
Identic
al
(
'en'
,
$comment
->
language
()
->
getId
());
$this
->
assert
Identic
al
(
'comment_no_subject'
,
$comment
->
getTypeId
());
$comment
=
entity_load
(
'comment'
,
2
);
$this
->
assert
Equ
al
(
'The response to the second comment.'
,
$comment
->
subject
->
value
);
$this
->
assert
Equal
(
3
,
$comment
->
pid
->
target_id
);
$this
->
assert
Identic
al
(
'The response to the second comment.'
,
$comment
->
subject
->
value
);
$this
->
assert
Identical
(
'3'
,
$comment
->
pid
->
target_id
);
$comment
=
entity_load
(
'comment'
,
3
);
$this
->
assert
Equ
al
(
'The second comment.'
,
$comment
->
subject
->
value
);
$this
->
assert
Equal
(
0
,
$comment
->
pid
->
target_id
);
$this
->
assert
Identic
al
(
'The second comment.'
,
$comment
->
subject
->
value
);
$this
->
assert
Identical
(
'0'
,
$comment
->
pid
->
target_id
);
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTypeTest.php
View file @
b1d2d7c3
...
...
@@ -42,9 +42,9 @@ protected function setUp() {
*/
public
function
testCommentType
()
{
$comment_type
=
entity_load
(
'comment_type'
,
'comment'
);
$this
->
assert
Equ
al
(
'node'
,
$comment_type
->
getTargetEntityTypeId
());
$this
->
assert
Identic
al
(
'node'
,
$comment_type
->
getTargetEntityTypeId
());
$comment_type
=
entity_load
(
'comment_type'
,
'comment_no_subject'
);
$this
->
assert
Equ
al
(
'node'
,
$comment_type
->
getTargetEntityTypeId
());
$this
->
assert
Identic
al
(
'node'
,
$comment_type
->
getTargetEntityTypeId
());
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityDisplayTest.php
View file @
b1d2d7c3
...
...
@@ -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
->
assert
Equ
al
(
$component
[
'label'
],
'hidden'
);
$this
->
assert
Equ
al
(
$component
[
'type'
],
'comment_default'
);
$this
->
assert
Equ
al
(
$component
[
'weight'
],
20
);
$this
->
assert
Identic
al
(
$component
[
'label'
],
'hidden'
);
$this
->
assert
Identic
al
(
$component
[
'type'
],
'comment_default'
);
$this
->
assert
Identic
al
(
$component
[
'weight'
],
20
);
}
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableEntityFormDisplaySubjectTest.php
View file @
b1d2d7c3
...
...
@@ -60,8 +60,8 @@ protected function setUp() {
public
function
testCommentEntityFormDisplay
()
{
$component
=
entity_get_form_display
(
'comment'
,
'comment'
,
'default'
)
->
getComponent
(
'subject'
);
$this
->
assert
Equ
al
(
$component
[
'type'
],
'string_textfield'
);
$this
->
assert
Equ
al
(
$component
[
'weight'
],
10
);
$this
->
assert
Identic
al
(
$component
[
'type'
],
'string_textfield'
);
$this
->
assert
Identic
al
(
$component
[
'weight'
],
10
);
$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 @
b1d2d7c3
...
...
@@ -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
->
assert
Equ
al
(
$component
[
'type'
],
'comment_default'
);
$this
->
assert
Equ
al
(
$component
[
'weight'
],
20
);
$this
->
assert
Identic
al
(
$component
[
'type'
],
'comment_default'
);
$this
->
assert
Identic
al
(
$component
[
'weight'
],
20
);
}
}
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateCommentVariableInstanceTest.php
View file @
b1d2d7c3
...
...
@@ -66,24 +66,24 @@ protected function setUp() {
*/
public
function
testCommentFieldInstance
()
{
$node
=
entity_create
(
'node'
,
array
(
'type'
=>
'page'
));
$this
->
assert
Equ
al
(
$node
->
comment
->
status
,
0
);
$this
->
assert
Equ
al
(
$node
->
comment
->
getFieldDefinition
()
->
getName
(),
'comment'
);
$this
->
assert
Identic
al
(
$node
->
comment
->
status
,
0
);
$this
->
assert
Identic
al
(
$node
->
comment
->
getFieldDefinition
()
->
getName
(),
'comment'
);
$settings
=
$node
->
comment
->
getFieldDefinition
()
->
getSettings
();
$this
->
assert
Equ
al
(
$settings
[
'default_mode'
],
4
);
$this
->
assert
Equ
al
(
$settings
[
'per_page'
],
50
);
$this
->
assert
Equ
al
(
$settings
[
'anonymous'
],
0
);
$this
->
assert
Equ
al
(
$settings
[
'form_location'
],
0
);
$this
->
assert
Equ
al
(
$settings
[
'preview'
],
1
);
$this
->
assert
Identic
al
(
$settings
[
'default_mode'
],
4
);
$this
->
assert
Identic
al
(
$settings
[
'per_page'
],
50
);
$this
->
assert
Identic
al
(
$settings
[
'anonymous'
],
0
);
$this
->
assert
Identic
al
(
$settings
[
'form_location'
],
FALSE
);
$this
->
assert
Identic
al
(
$settings
[
'preview'
],
1
);
$node
=
entity_create
(
'node'
,
array
(
'type'
=>
'story'
));
$this
->
assert
Equ
al
(
$node
->
comment_no_subject
->
status
,
2
);
$this
->
assert
Equ
al
(
$node
->
comment_no_subject
->
getFieldDefinition
()
->
getName
(),
'comment_no_subject'
);
$this
->
assert
Identic
al
(
$node
->
comment_no_subject
->
status
,
2
);
$this
->
assert
Identic
al
(
$node
->
comment_no_subject
->
getFieldDefinition
()
->
getName
(),
'comment_no_subject'
);
$settings
=
$node
->
comment_no_subject
->
getFieldDefinition
()
->
getSettings
();
$this
->
assert
Equ
al
(
$settings
[
'default_mode'
],
2
);
$this
->
assert
Equ
al
(
$settings
[
'per_page'
],
70
);
$this
->
assert
Equ
al
(
$settings
[
'anonymous'
],
1
);
$this
->
assert
Equ
al
(
$settings
[
'form_location'
],
0
);
$this
->
assert
Equ
al
(
$settings
[
'preview'
],
0
);
$this
->
assert
Identic
al
(
$settings
[
'default_mode'
],
2
);
$this
->
assert
Identic
al
(
$settings
[
'per_page'
],
70
);
$this
->
assert
Identic
al
(
$settings
[
'anonymous'
],
1
);
$this
->
assert
Identic
al
(
$settings
[
'form_location'
],
FALSE
);
$this
->
assert
Identic
al
(
$settings
[
'preview'
],
0
);
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateContactCategoryTest.php
View file @
b1d2d7c3
...
...
@@ -46,22 +46,22 @@ protected function setUp() {
public
function
testContactCategory
()
{
/** @var \Drupal\contact\Entity\ContactForm $contact_form */
$contact_form
=
ContactForm
::
load
(
'website_feedback'
);
$this
->
assert
Equ
al
(
$contact_form
->
label
(),
'Website feedback'
);
$this
->
assert
Equ
al
(
$contact_form
->
getRecipients
(),
array
(
'admin@example.com'
));
$this
->
assert
Equ
al
(
$contact_form
->
getReply
(),
''
);
$this
->
assert
Equ
al
(
$contact_form
->
getWeight
(),
0
);
$this
->
assert
Identic
al
(
$contact_form
->
label
(),
'Website feedback'
);
$this
->
assert
Identic
al
(
$contact_form
->
getRecipients
(),
array
(
'admin@example.com'
));
$this
->
assert
Identic
al
(
$contact_form
->
getReply
(),
''
);
$this
->
assert
Identic
al
(
$contact_form
->
getWeight
(),
0
);
$contact_form
=
ContactForm
::
load
(
'some_other_category'
);
$this
->
assert
Equ
al
(
$contact_form
->
label
(),
'Some other category'
);
$this
->
assert
Equ
al
(
$contact_form
->
getRecipients
(),
array
(
'test@example.com'
));
$this
->
assert
Equ
al
(
$contact_form
->
getReply
(),
'Thanks for contacting us, we will reply ASAP!'
);
$this
->
assert
Equ
al
(
$contact_form
->
getWeight
(),
1
);
$this
->
assert
Identic
al
(
$contact_form
->
label
(),
'Some other category'
);
$this
->
assert
Identic
al
(
$contact_form
->
getRecipients
(),
array
(
'test@example.com'
));
$this
->
assert
Identic
al
(
$contact_form
->
getReply
(),
'Thanks for contacting us, we will reply ASAP!'
);
$this
->
assert
Identic
al
(
$contact_form
->
getWeight
(),
1
);
$contact_form
=
ContactForm
::
load
(
'a_category_much_longer_than_thir'
);
$this
->
assert
Equ
al
(
$contact_form
->
label
(),
'A category much longer than thirty two characters'
);
$this
->
assert
Equ
al
(
$contact_form
->
getRecipients
(),
array
(
'fortyninechars@example.com'
));
$this
->
assert
Equ
al
(
$contact_form
->
getReply
(),
''
);
$this
->
assert
Equ
al
(
$contact_form
->
getWeight
(),
2
);
$this
->
assert
Identic
al
(
$contact_form
->
label
(),
'A category much longer than thirty two characters'
);
$this
->
assert
Identic
al
(
$contact_form
->
getRecipients
(),
array
(
'fortyninechars@example.com'
));
$this
->
assert
Identic
al
(
$contact_form
->
getReply
(),
''
);
$this
->
assert
Identic
al
(
$contact_form
->
getWeight
(),
2
);
}
}
core/modules/migrate_drupal/src/Tests/d6/MigrateDateFormatTest.php
View file @
b1d2d7c3
...
...
@@ -35,13 +35,13 @@ protected function setUp() {
*/
public
function
testDateFormats
()
{
$short_date_format
=
entity_load
(
'date_format'
,
'short'
);
$this
->
assert
Equ
al
(
'\S\H\O\R\T m/d/Y - H:i'
,
$short_date_format
->
getPattern
());
$this
->
assert
Identic
al
(
'\S\H\O\R\T m/d/Y - H:i'
,
$short_date_format
->
getPattern
());
$medium_date_format
=
entity_load
(
'date_format'
,
'medium'
);
$this
->
assert
Equ
al
(
'\M\E\D\I\U\M D, m/d/Y - H:i'
,
$medium_date_format
->
getPattern
());
$this
->
assert
Identic
al
(
'\M\E\D\I\U\M D, m/d/Y - H:i'
,
$medium_date_format
->
getPattern
());
$long_date_format
=
entity_load
(
'date_format'
,
'long'
);
$this
->
assert
Equ
al
(
'\L\O\N\G l, F j, Y - H:i'
,
$long_date_format
->
getPattern
());
$this
->
assert
Identic
al
(
'\L\O\N\G l, F j, Y - H:i'
,
$long_date_format
->
getPattern
());
// Test that we can re-import using the EntityDateFormat destination.
Database
::
getConnection
(
'default'
,
'migrate'
)
...
...
@@ -55,7 +55,7 @@ public function testDateFormats() {
$executable
->
import
();
$short_date_format
=
entity_load
(
'date_format'
,
'short'
);
$this
->
assert
Equ
al
(
'\S\H\O\R\T d/m/Y - H:i'
,
$short_date_format
->
getPattern
());
$this
->
assert
Identic
al
(
'\S\H\O\R\T d/m/Y - H:i'
,
$short_date_format
->
getPattern
());
}
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateFieldFormatterSettingsTest.php
View file @
b1d2d7c3
...
...
@@ -84,8 +84,8 @@ public function testEntityDisplaySettings() {
// Run tests.
$field_name
=
"field_test"
;
$expected
=
array
(
'weight'
=>
1
,
'label'
=>
'above'
,
'weight'
=>
1
,
'type'
=>
'text_trimmed'
,
'settings'
=>
array
(
'trim_length'
=>
600
),
'third_party_settings'
=>
array
(),
...
...
@@ -93,23 +93,23 @@ public function testEntityDisplaySettings() {
// Can we load any entity display.
$display
=
entity_load
(
'entity_view_display'
,
'node.story.teaser'
);
$this
->
assert
Equ
al
(
$display
->
getComponent
(
$field_name
),
$expected
);
$this
->
assert
Identic
al
(
$display
->
getComponent
(
$field_name
),
$expected
);
// Test migrate worked with multiple bundles.
$display
=
entity_load
(
'entity_view_display'
,
'node.test_page.teaser'
);
$expected
[
'weight'
]
=
35
;
$this
->
assert
Equ
al
(
$display
->
getComponent
(
$field_name
),
$expected
);
$this
->
assert
Identic
al
(
$display
->
getComponent
(
$field_name
),
$expected
);