Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\system\Unit\Migrate\source\d6\MenuTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\system\Unit\Migrate\source\d6;
|
||||
|
||||
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
|
||||
|
||||
/**
|
||||
* Tests D6 menu source plugin.
|
||||
*
|
||||
* @group system
|
||||
*/
|
||||
class MenuTest 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\system\Plugin\migrate\source\d6\Menu';
|
||||
|
||||
// The fake Migration configuration entity.
|
||||
protected $migrationConfiguration = array(
|
||||
// The ID of the entity, can be any string.
|
||||
'id' => 'test',
|
||||
// Leave it empty for now.
|
||||
'idlist' => array(),
|
||||
// This needs to be the identifier of the actual key: cid for comment, nid
|
||||
// for node and so on.
|
||||
'source' => array(
|
||||
'plugin' => 'd6_menu',
|
||||
),
|
||||
);
|
||||
|
||||
// We need to set up the database contents; it's easier to do that below.
|
||||
|
||||
protected $expectedResults = array(
|
||||
array(
|
||||
'menu_name' => 'menu-name-1',
|
||||
'title' => 'menu custom value 1',
|
||||
'description' => 'menu custom description value 1',
|
||||
),
|
||||
array(
|
||||
'menu_name' => 'menu-name-2',
|
||||
'title' => 'menu custom value 2',
|
||||
'description' => 'menu custom description value 2',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
// This array stores the database.
|
||||
foreach ($this->expectedResults as $k => $row) {
|
||||
$this->databaseContents['menu_custom'][$k] = $row;
|
||||
}
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -50,6 +50,13 @@ class MachineNameControllerTest extends UnitTestCase {
|
|||
array(array('text' => 'Bob', 'langcode' => 'en', 'replace' => 'Alice', 'replace_pattern' => 'Tom'), '"Bob"'),
|
||||
array(array('text' => 'Äwesome', 'langcode' => 'en', 'lowercase' => TRUE), '"awesome"'),
|
||||
array(array('text' => 'Äwesome', 'langcode' => 'de', 'lowercase' => TRUE), '"aewesome"'),
|
||||
// Tests special characters replacement in the input text.
|
||||
array(array('text' => 'B?!"@\/-ob@e', 'langcode' => 'en', 'lowercase' => TRUE, 'replace' => '_', 'replace_pattern' => '[^a-z0-9_.]+'), '"b_ob_e"'),
|
||||
// Tests @ character in the replace_pattern regex.
|
||||
array(array('text' => 'Bob@e\0', 'langcode' => 'en', 'lowercase' => TRUE, 'replace' => '_', 'replace_pattern' => '[^a-z0-9_.@]+'), '"bob@e_0"'),
|
||||
// Tests null byte in the replace_pattern regex.
|
||||
array(array('text' => 'Bob', 'langcode' => 'en', 'lowercase' => TRUE, 'replace' => 'fail()', 'replace_pattern' => ".*@e\0"), '"bob"'),
|
||||
array(array('text' => 'Bob@e', 'langcode' => 'en', 'lowercase' => TRUE, 'replace' => 'fail()', 'replace_pattern' => ".*@e\0"), '"fail()"'),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue