X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fcomment%2Ftests%2Fsrc%2FKernel%2FMigrate%2Fd7%2FMigrateCommentEntityFormDisplaySubjectTest.php;h=2c3025a449177a008a232686291cf6fb7585f4db;hb=refs%2Fheads%2Fd864;hp=8ce439a9cfba16452823b76e4db34803f5d99f20;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityFormDisplaySubjectTest.php b/web/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityFormDisplaySubjectTest.php index 8ce439a9c..2c3025a44 100644 --- a/web/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityFormDisplaySubjectTest.php +++ b/web/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentEntityFormDisplaySubjectTest.php @@ -6,12 +6,16 @@ use Drupal\Core\Entity\Entity\EntityFormDisplay; use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; /** - * Tests migration of comment form's subject display configuration. + * Tests the migration of comment form's subject display from Drupal 7. * * @group comment + * @group migrate_drupal_7 */ class MigrateCommentEntityFormDisplaySubjectTest extends MigrateDrupal7TestBase { + /** + * {@inheritdoc} + */ public static $modules = ['node', 'comment', 'text', 'menu_ui']; /** @@ -19,37 +23,47 @@ class MigrateCommentEntityFormDisplaySubjectTest extends MigrateDrupal7TestBase */ protected function setUp() { parent::setUp(); - $this->installConfig(static::$modules); + $this->installConfig(['comment']); $this->executeMigrations([ - 'd7_node_type', 'd7_comment_type', 'd7_comment_entity_form_display_subject', ]); } /** - * Asserts a display entity. + * Asserts that the comment subject field is visible for a node type. + * + * @param string $id + * The entity form display ID. + */ + protected function assertSubjectVisible($id) { + $component = EntityFormDisplay::load($id)->getComponent('subject'); + $this->assertInternalType('array', $component); + $this->assertSame('string_textfield', $component['type']); + $this->assertSame(10, $component['weight']); + } + + /** + * Asserts that the comment subject field is not visible for a node type. * * @param string $id - * The entity ID. + * The entity form display ID. */ - protected function assertDisplay($id) { + protected function assertSubjectNotVisible($id) { $component = EntityFormDisplay::load($id)->getComponent('subject'); - $this->assertTrue(is_array($component)); - $this->assertIdentical('string_textfield', $component['type']); - $this->assertIdentical(10, $component['weight']); + $this->assertNull($component); } /** * Tests the migrated display configuration. */ public function testMigration() { - $this->assertDisplay('comment.comment_node_page.default'); - $this->assertDisplay('comment.comment_node_article.default'); - $this->assertDisplay('comment.comment_node_book.default'); - $this->assertDisplay('comment.comment_node_blog.default'); - $this->assertDisplay('comment.comment_node_forum.default'); - $this->assertDisplay('comment.comment_node_test_content_type.default'); + $this->assertSubjectVisible('comment.comment_node_page.default'); + $this->assertSubjectVisible('comment.comment_node_article.default'); + $this->assertSubjectVisible('comment.comment_node_book.default'); + $this->assertSubjectVisible('comment.comment_node_blog.default'); + $this->assertSubjectVisible('comment.comment_forum.default'); + $this->assertSubjectNotVisible('comment.comment_node_test_content_type.default'); } }