updated core

This commit is contained in:
Bachir Soussi Chiadmi
2018-01-24 13:36:32 +01:00
parent cd7dea45a9
commit f9374cf96d
1997 changed files with 5175 additions and 127715 deletions
@@ -7,8 +7,8 @@ package: Testing
dependencies:
- comment
# Information added by Drupal.org packaging script on 2017-11-03
version: '8.4.2'
# Information added by Drupal.org packaging script on 2018-01-03
version: '8.4.4'
core: '8.x'
project: 'drupal'
datestamp: 1509719929
datestamp: 1515021228
@@ -7,8 +7,8 @@ package: Testing
dependencies:
- comment
# Information added by Drupal.org packaging script on 2017-11-03
version: '8.4.2'
# Information added by Drupal.org packaging script on 2018-01-03
version: '8.4.4'
core: '8.x'
project: 'drupal'
datestamp: 1509719929
datestamp: 1515021228
@@ -8,8 +8,8 @@ dependencies:
- comment
- views
# Information added by Drupal.org packaging script on 2017-11-03
version: '8.4.2'
# Information added by Drupal.org packaging script on 2018-01-03
version: '8.4.4'
core: '8.x'
project: 'drupal'
datestamp: 1509719929
datestamp: 1515021228
@@ -54,7 +54,6 @@ class CommentThreadingTest extends CommentTestBase {
// Confirm that there is a link to the parent comment.
$this->assertParentLink($comment1_3->id(), $comment1->id());
// Reply to comment #1_3 creating comment #1_3_4.
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment1_3->id());
$comment1_3_4 = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
@@ -71,6 +71,9 @@ class CommentItemTest extends FieldKernelTestBase {
public function testCommentAuthorName() {
$this->installEntitySchema('comment');
$host = EntityTest::create(['name' => $this->randomString()]);
$host->save();
// Create some comments.
$comment = Comment::create([
'subject' => 'My comment title',
@@ -78,6 +81,7 @@ class CommentItemTest extends FieldKernelTestBase {
'name' => 'entity-test',
'mail' => 'entity@localhost',
'entity_type' => 'entity_test',
'entity_id' => $host->id(),
'comment_type' => 'entity_test',
'status' => 1,
]);
@@ -95,6 +99,7 @@ class CommentItemTest extends FieldKernelTestBase {
'mail' => 'test@example.com',
'homepage' => 'https://example.com',
'entity_type' => 'entity_test',
'entity_id' => $host->id(),
'comment_type' => 'entity_test',
'status' => 1,
]);
@@ -1,31 +0,0 @@
<?php
namespace Drupal\Tests\comment\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Base class for Drupal 6 comment variables to Drupal 8 entity display tests.
*/
abstract class MigrateCommentVariableDisplayBase extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['comment'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installConfig(['comment']);
$this->migrateContentTypes();
$this->executeMigrations([
'd6_comment_type',
'd6_comment_field',
'd6_comment_field_instance',
]);
}
}
@@ -1,39 +0,0 @@
<?php
namespace Drupal\Tests\comment\Kernel\Migrate\d6;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
/**
* Upgrade comment variables to entity.display.node.*.default.yml.
*
* @group migrate_drupal_6
*/
class MigrateCommentVariableEntityDisplayTest extends MigrateCommentVariableDisplayBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('d6_comment_entity_display');
}
/**
* Tests comment variables migrated into an entity display.
*/
public function testCommentEntityDisplay() {
foreach (['page', 'story', 'article'] as $type) {
$component = EntityViewDisplay::load('node.' . $type . '.default')->getComponent('comment');
$this->assertIdentical('hidden', $component['label']);
$this->assertIdentical('comment_default', $component['type']);
$this->assertIdentical(20, $component['weight']);
}
}
}
@@ -1,45 +0,0 @@
<?php
namespace Drupal\Tests\comment\Kernel\Migrate\d6;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade comment subject variable to core.entity_form_display.comment.*.default.yml
*
* @group migrate_drupal_6
*/
class MigrateCommentVariableEntityFormDisplaySubjectTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['comment'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installConfig(['comment']);
$this->executeMigrations([
'd6_comment_type',
'd6_comment_entity_form_display_subject',
]);
}
/**
* Tests comment subject variable migrated into an entity display.
*/
public function testCommentEntityFormDisplay() {
$component = EntityFormDisplay::load('comment.comment.default')
->getComponent('subject');
$this->assertIdentical('string_textfield', $component['type']);
$this->assertIdentical(10, $component['weight']);
$component = EntityFormDisplay::load('comment.comment_no_subject.default')
->getComponent('subject');
$this->assertNull($component);
}
}
@@ -1,39 +0,0 @@
<?php
namespace Drupal\Tests\comment\Kernel\Migrate\d6;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
/**
* Upgrade comment variables to core.entity_form_display.node.*.default.yml.
*
* @group migrate_drupal_6
*/
class MigrateCommentVariableEntityFormDisplayTest extends MigrateCommentVariableDisplayBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('d6_comment_entity_form_display');
}
/**
* Tests comment variables migrated into an entity display.
*/
public function testCommentEntityFormDisplay() {
foreach (['page', 'article', 'story'] as $type) {
$component = EntityFormDisplay::load('node.' . $type . '.default')
->getComponent('comment');
$this->assertIdentical('comment_default', $component['type']);
$this->assertIdentical(20, $component['weight']);
}
}
}
@@ -1,37 +0,0 @@
<?php
namespace Drupal\Tests\comment\Kernel\Migrate\d6;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade comment variables to field.storage.node.comment.yml.
*
* @group migrate_drupal_6
*/
class MigrateCommentVariableFieldTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['comment', 'menu_ui'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installConfig(['comment']);
$this->migrateContentTypes();
$this->executeMigrations(['d6_comment_type', 'd6_comment_field']);
}
/**
* Tests comment variables migrated into a field entity.
*/
public function testCommentField() {
$this->assertTrue(is_object(FieldStorageConfig::load('node.comment')));
}
}
@@ -1,60 +0,0 @@
<?php
namespace Drupal\Tests\comment\Kernel\Migrate\d6;
use Drupal\comment\CommentManagerInterface;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
use Drupal\node\Entity\Node;
/**
* Upgrade comment variables to field.instance.node.*.comment.yml.
*
* @group migrate_drupal_6
*/
class MigrateCommentVariableInstanceTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['comment', 'menu_ui'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installConfig(['comment']);
$this->migrateContentTypes();
$this->executeMigrations([
'd6_comment_type',
'd6_comment_field',
'd6_comment_field_instance',
]);
}
/**
* Test the migrated field instance values.
*/
public function testCommentFieldInstance() {
$node = Node::create(['type' => 'page']);
$this->assertIdentical(0, $node->comment->status);
$this->assertIdentical('comment', $node->comment->getFieldDefinition()->getName());
$settings = $node->comment->getFieldDefinition()->getSettings();
$this->assertIdentical(CommentManagerInterface::COMMENT_MODE_THREADED, $settings['default_mode']);
$this->assertIdentical(50, $settings['per_page']);
$this->assertFalse($settings['anonymous']);
$this->assertFalse($settings['form_location']);
$this->assertTrue($settings['preview']);
$node = Node::create(['type' => 'story']);
$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(CommentManagerInterface::COMMENT_MODE_FLAT, $settings['default_mode']);
$this->assertIdentical(70, $settings['per_page']);
$this->assertTrue($settings['anonymous']);
$this->assertFalse($settings['form_location']);
$this->assertFalse($settings['preview']);
}
}
@@ -18,6 +18,13 @@ use Drupal\views\Views;
*/
class CommentLinksTest extends CommentViewsKernelTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['entity_test'];
/**
* Views used by this test.
*
@@ -25,15 +32,27 @@ class CommentLinksTest extends CommentViewsKernelTestBase {
*/
public static $testViews = ['test_comment'];
/**
* {@inheritdoc}
*/
protected function setUp($import_test_views = TRUE) {
parent::setUp($import_test_views);
$this->installEntitySchema('entity_test');
}
/**
* Test the comment approve link.
*/
public function testLinkApprove() {
$host = EntityTest::create(['name' => $this->randomString()]);
$host->save();
// Create an unapproved comment.
$comment = $this->commentStorage->create([
'uid' => $this->adminUser->id(),
'entity_type' => 'entity_test',
'entity_id' => $host->id(),
'comment_type' => 'entity_test',
'status' => 0,
]);
@@ -91,8 +110,7 @@ class CommentLinksTest extends CommentViewsKernelTestBase {
* Test the comment reply link.
*/
public function testLinkReply() {
$this->enableModules(['field', 'entity_test']);
$this->installEntitySchema('entity_test');
$this->enableModules(['field']);
$this->installSchema('comment', ['comment_entity_statistics']);
$this->installConfig(['field']);
@@ -4,6 +4,7 @@ namespace Drupal\Tests\comment\Kernel\Views;
use Drupal\comment\Entity\Comment;
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
use Drupal\user\Entity\Role;
use Drupal\user\Entity\User;
@@ -36,6 +37,7 @@ class CommentUserNameTest extends ViewsKernelTestBase {
$this->installEntitySchema('user');
$this->installEntitySchema('comment');
$this->installEntitySchema('entity_test');
// Create the anonymous role.
$this->installConfig(['user']);
@@ -67,12 +69,16 @@ class CommentUserNameTest extends ViewsKernelTestBase {
]);
$this->adminUser->save();
$host = EntityTest::create(['name' => $this->randomString()]);
$host->save();
// Create some comments.
$comment = Comment::create([
'subject' => 'My comment title',
'uid' => $this->adminUser->id(),
'name' => $this->adminUser->label(),
'entity_type' => 'entity_test',
'entity_id' => $host->id(),
'comment_type' => 'entity_test',
'status' => 1,
]);
@@ -85,6 +91,7 @@ class CommentUserNameTest extends ViewsKernelTestBase {
'mail' => 'test@example.com',
'homepage' => 'https://example.com',
'entity_type' => 'entity_test',
'entity_id' => $host->id(),
'comment_type' => 'entity_test',
'created' => 123456,
'status' => 1,
@@ -3,6 +3,7 @@
namespace Drupal\Tests\comment\Kernel\Views;
use Drupal\comment\Entity\Comment;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\user\Entity\User;
use Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase;
@@ -25,6 +26,7 @@ class CommentViewsFieldAccessTest extends FieldFieldAccessTestBase {
parent::setUp($import_test_views);
$this->installEntitySchema('comment');
$this->installEntitySchema('entity_test');
}
/**
@@ -36,10 +38,14 @@ class CommentViewsFieldAccessTest extends FieldFieldAccessTestBase {
]);
$user->save();
$host = EntityTest::create(['name' => $this->randomString()]);
$host->save();
$comment = Comment::create([
'subject' => 'My comment title',
'uid' => $user->id(),
'entity_type' => 'entity_test',
'entity_id' => $host->id(),
'comment_type' => 'entity_test',
]);
$comment->save();
@@ -51,6 +57,7 @@ class CommentViewsFieldAccessTest extends FieldFieldAccessTestBase {
'mail' => 'test@example.com',
'homepage' => 'https://example.com',
'entity_type' => 'entity_test',
'entity_id' => $host->id(),
'comment_type' => 'entity_test',
'created' => 123456,
'status' => 1,
@@ -1,23 +0,0 @@
<?php
namespace Drupal\Tests\comment\Unit\Migrate\d6;
/**
* Tests the Drupal 6 comment source w/ high water handling.
*
* @group comment
*/
class CommentSourceWithHighWaterTest extends CommentTestBase {
const ORIGINAL_HIGH_WATER = 1382255613;
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->migrationConfiguration['highWaterProperty']['field'] = 'timestamp';
array_shift($this->expectedResults);
parent::setUp();
}
}
@@ -1,12 +0,0 @@
<?php
namespace Drupal\Tests\comment\Unit\Migrate\d6;
/**
* Tests D6 comment source plugin.
*
* @group comment
*/
class CommentTest extends CommentTestBase {
}
@@ -1,80 +0,0 @@
<?php
namespace Drupal\Tests\comment\Unit\Migrate\d6;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
/**
* Base class for comment source unit tests.
*/
abstract class CommentTestBase extends MigrateSqlSourceTestCase {
// The plugin system is not working during unit testing so the source plugin
// class needs to be manually specified.
const PLUGIN_CLASS = 'Drupal\comment\Plugin\migrate\source\d6\Comment';
// The fake Migration configuration entity.
protected $migrationConfiguration = array(
// The ID of the entity, can be any string.
'id' => 'test',
// This needs to be the identifier of the actual key: cid for comment, nid
// for node and so on.
'source' => array(
'plugin' => 'd6_comment',
),
);
// We need to set up the database contents; it's easier to do that below.
protected $expectedResults = array(
array(
'cid' => 1,
'pid' => 0,
'nid' => 2,
'uid' => 3,
'subject' => 'subject value 1',
'comment' => 'comment value 1',
'hostname' => 'hostname value 1',
'timestamp' => 1382255613,
'status' => 1,
'thread' => '',
'name' => '',
'mail' => '',
'homepage' => '',
'format' => 'testformat1',
'type' => 'story',
),
array(
'cid' => 2,
'pid' => 1,
'nid' => 3,
'uid' => 4,
'subject' => 'subject value 2',
'comment' => 'comment value 2',
'hostname' => 'hostname value 2',
'timestamp' => 1382255662,
'status' => 1,
'thread' => '',
'name' => '',
'mail' => '',
'homepage' => '',
'format' => 'testformat2',
'type' => 'page',
),
);
/**
* {@inheritdoc}
*/
protected function setUp() {
foreach ($this->expectedResults as $k => $row) {
$this->databaseContents['comments'][$k] = $row;
$this->databaseContents['comments'][$k]['status'] = 1 - $this->databaseContents['comments'][$k]['status'];
}
// Add node table data.
$this->databaseContents['node'][] = array('nid' => 2, 'type' => 'story');
$this->databaseContents['node'][] = array('nid' => 3, 'type' => 'page');
parent::setUp();
}
}
@@ -1,59 +0,0 @@
<?php
namespace Drupal\Tests\comment\Unit\Migrate\d6;
use Drupal\comment\Plugin\migrate\source\d6\CommentVariablePerCommentType;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
/**
* @coversDefaultClass \Drupal\comment\Plugin\migrate\source\d6\CommentVariablePerCommentType
* @group comment
*/
class CommentVariablePerCommentTypeTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = CommentVariablePerCommentType::class;
protected $migrationConfiguration = array(
'id' => 'test',
'source' => array(
'plugin' => 'd6_comment_variable_per_comment_type',
),
);
protected $expectedResults = array(
// Each result will also include a label and description, but those are
// static values set by the source plugin and don't need to be asserted.
array(
'comment_type' => 'comment_no_subject',
),
array(
'comment_type' => 'comment',
),
);
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->databaseContents['node_type'] = array(
array(
'type' => 'page',
),
array(
'type' => 'story',
),
);
$this->databaseContents['variable'] = array(
array(
'name' => 'comment_subject_field_page',
'value' => serialize(1),
),
array(
'name' => 'comment_subject_field_story',
'value' => serialize(0),
),
);
parent::setUp();
}
}
@@ -1,89 +0,0 @@
<?php
namespace Drupal\Tests\comment\Unit\Migrate\d6;
use Drupal\comment\Plugin\migrate\source\d6\CommentVariable;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
/**
* @coversDefaultClass \Drupal\comment\Plugin\migrate\source\d6\CommentVariable
* @group comment
*/
class CommentVariableTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = CommentVariable::class;
protected $migrationConfiguration = array(
'id' => 'test',
'source' => array(
'plugin' => 'd6_comment_variable',
),
);
protected $expectedResults = array(
array(
'comment' => '1',
'comment_default_mode' => '1',
'comment_default_order' => '1',
'comment_default_per_page' => '50',
'comment_controls' => '1',
'comment_anonymous' => '1',
'comment_subject_field' => '1',
'comment_preview' => '1',
'comment_form_location' => '1',
'node_type' => 'page',
'comment_type' => 'comment',
),
);
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->databaseContents['node_type'] = array(
array(
'type' => 'page',
),
);
$this->databaseContents['variable'] = array(
array(
'name' => 'comment_page',
'value' => serialize(1),
),
array(
'name' => 'comment_default_mode_page',
'value' => serialize(1),
),
array(
'name' => 'comment_default_order_page',
'value' => serialize(1),
),
array(
'name' => 'comment_default_per_page_page',
'value' => serialize(50),
),
array(
'name' => 'comment_controls_page',
'value' => serialize(1),
),
array(
'name' => 'comment_anonymous_page',
'value' => serialize(1),
),
array(
'name' => 'comment_subject_field_page',
'value' => serialize(1),
),
array(
'name' => 'comment_preview_page',
'value' => serialize(1),
),
array(
'name' => 'comment_form_location_page',
'value' => serialize(1),
),
);
parent::setUp();
}
}
@@ -1,100 +0,0 @@
<?php
namespace Drupal\Tests\comment\Unit\Migrate\d7;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
/**
* Tests D7 comment source plugin.
*
* @group comment
*/
class CommentTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = 'Drupal\comment\Plugin\migrate\source\d7\Comment';
protected $migrationConfiguration = array(
'id' => 'test',
'source' => array(
'plugin' => 'd7_comment',
),
);
protected $expectedResults = array(
array(
'cid' => '1',
'pid' => '0',
'nid' => '1',
'uid' => '1',
'subject' => 'A comment',
'hostname' => '::1',
'created' => '1421727536',
'changed' => '1421727536',
'status' => '1',
'thread' => '01/',
'name' => 'admin',
'mail' => '',
'homepage' => '',
'language' => 'und',
'comment_body' => array(
array(
'value' => 'This is a comment',
'format' => 'filtered_html',
),
),
),
);
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->databaseContents['comment'] = $this->expectedResults;
unset($this->databaseContents['comment'][0]['comment_body']);
$this->databaseContents['node'] = array(
array(
'nid' => '1',
'vid' => '1',
'type' => 'test_content_type',
'language' => 'en',
'title' => 'A Node',
'uid' => '1',
'status' => '1',
'created' => '1421727515',
'changed' => '1421727515',
'comment' => '2',
'promote' => '1',
'sticky' => '0',
'tnid' => '0',
'translate' => '0',
),
);
$this->databaseContents['field_config_instance'] = array(
array(
'id' => '14',
'field_id' => '1',
'field_name' => 'comment_body',
'entity_type' => 'comment',
'bundle' => 'comment_node_test_content_type',
'data' => 'a:0:{}',
'deleted' => '0',
),
);
$this->databaseContents['field_data_comment_body'] = array(
array(
'entity_type' => 'comment',
'bundle' => 'comment_node_test_content_type',
'deleted' => '0',
'entity_id' => '1',
'revision_id' => '1',
'language' => 'und',
'delta' => '0',
'comment_body_value' => 'This is a comment',
'comment_body_format' => 'filtered_html',
),
);
parent::setUp();
}
}
@@ -1,98 +0,0 @@
<?php
namespace Drupal\Tests\comment\Unit\Migrate\d7;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
/**
* Tests D7 comment type source plugin.
*
* @group comment
*/
class CommentTypeTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = 'Drupal\comment\Plugin\migrate\source\d7\CommentType';
protected $migrationConfiguration = array(
'id' => 'test',
'source' => array(
'plugin' => 'd7_comment_type',
),
);
protected $expectedResults = array(
array(
'bundle' => 'comment_node_article',
'node_type' => 'article',
'default_mode' => '1',
'per_page' => '50',
'anonymous' => '0',
'form_location' => '1',
'preview' => '0',
'subject' => '1',
'label' => 'Article comment',
),
);
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->databaseContents['node_type'] = array(
array(
'type' => 'article',
'name' => 'Article',
'base' => 'node_content',
'module' => 'node',
'description' => 'Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.',
'help' => 'Help text for articles',
'has_title' => '1',
'title_label' => 'Title',
'custom' => '1',
'modified' => '1',
'locked' => '0',
'disabled' => '0',
'orig_type' => 'article',
),
);
$this->databaseContents['field_config_instance'] = array(
array(
'id' => '14',
'field_id' => '1',
'field_name' => 'comment_body',
'entity_type' => 'comment',
'bundle' => 'comment_node_article',
'data' => 'a:0:{}',
'deleted' => '0',
),
);
$this->databaseContents['variable'] = array(
array(
'name' => 'comment_default_mode_article',
'value' => serialize(1),
),
array(
'name' => 'comment_per_page_article',
'value' => serialize(50),
),
array(
'name' => 'comment_anonymous_article',
'value' => serialize(0),
),
array(
'name' => 'comment_form_location_article',
'value' => serialize(1),
),
array(
'name' => 'comment_preview_article',
'value' => serialize(0),
),
array(
'name' => 'comment_subject_article',
'value' => serialize(1),
),
);
parent::setUp();
}
}