Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023

This commit is contained in:
Pantheon Automation 2015-09-04 13:20:09 -07:00 committed by Greg Anderson
parent 2720a9ec4b
commit f3791f1da3
1898 changed files with 54300 additions and 11481 deletions

View file

@ -13,7 +13,7 @@ use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* Upgrade variables to taxonomy.settings.yml.
*
* @group taxonomy
* @group migrate_drupal_6
*/
class MigrateTaxonomyConfigsTest extends MigrateDrupal6TestBase {
@ -31,7 +31,6 @@ class MigrateTaxonomyConfigsTest extends MigrateDrupal6TestBase {
*/
protected function setUp() {
parent::setUp();
$this->loadDumps(['Variable.php']);
$this->executeMigration('d6_taxonomy_settings');
}

View file

@ -13,7 +13,7 @@ use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* Upgrade taxonomy terms.
*
* @group taxonomy
* @group migrate_drupal_6
*/
class MigrateTaxonomyTermTest extends MigrateDrupal6TestBase {
@ -33,12 +33,6 @@ class MigrateTaxonomyTermTest extends MigrateDrupal6TestBase {
array(array(2), array('vocabulary_2_i_1_')),
array(array(3), array('vocabulary_3_i_2_')),
)));
$this->loadDumps([
'TermData.php',
'TermHierarchy.php',
'Vocabulary.php',
'VocabularyNodeTypes.php',
]);
$this->executeMigration('d6_taxonomy_term');
}

View file

@ -13,7 +13,7 @@ use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* Migrate taxonomy vocabularies to taxonomy.vocabulary.*.yml.
*
* @group taxonomy
* @group migrate_drupal_6
*/
class MigrateTaxonomyVocabularyTest extends MigrateDrupal6TestBase {
@ -29,7 +29,6 @@ class MigrateTaxonomyVocabularyTest extends MigrateDrupal6TestBase {
*/
protected function setUp() {
parent::setUp();
$this->loadDumps(['Vocabulary.php', 'VocabularyNodeTypes.php']);
$this->executeMigration('d6_taxonomy_vocabulary');
}

View file

@ -7,12 +7,12 @@
namespace Drupal\taxonomy\Tests\Migrate\d6;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate\Entity\Migration;
/**
* Upgrade taxonomy term node associations.
*
* @group taxonomy
* @group migrate_drupal_6
*/
class MigrateTermNodeRevisionTest extends MigrateTermNodeTestBase {
@ -22,20 +22,17 @@ class MigrateTermNodeRevisionTest extends MigrateTermNodeTestBase {
protected function setUp() {
parent::setUp();
$id_mappings = array(
'd6_term_node' => array(
'd6_term_node:*' => array(
array(array(2), array(1)),
),
'd6_node_revision' => array(
'd6_node_revision:*' => array(
array(array(2), array(2)),
),
);
$this->prepareMigrations($id_mappings);
/** @var \Drupal\migrate\entity\Migration $migration */
$migrations = entity_load_multiple('migration', array('d6_term_node_revision:*'));
foreach ($migrations as $migration) {
$executable = new MigrateExecutable($migration, $this);
$executable->import();
}
$migrations = Migration::loadMultiple(['d6_term_node_revision:*']);
array_walk($migrations, [$this, 'executeMigration']);
}
/**

View file

@ -7,13 +7,14 @@
namespace Drupal\taxonomy\Tests\Migrate\d6;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate\MigrateExecutable;
use Drupal\node\Entity\Node;
/**
* Upgrade taxonomy term node associations.
*
* @group taxonomy
* @group migrate_drupal_6
*/
class MigrateTermNodeTest extends MigrateTermNodeTestBase {
@ -22,12 +23,17 @@ class MigrateTermNodeTest extends MigrateTermNodeTestBase {
*/
protected function setUp() {
parent::setUp();
/** @var \Drupal\migrate\entity\Migration $migration */
$migrations = entity_load_multiple('migration', array('d6_term_node:*'));
foreach ($migrations as $migration) {
$executable = new MigrateExecutable($migration, $this);
$executable->import();
}
$id_mappings = array(
'd6_node:*' => array(
array(
array(0),
array(0),
),
),
);
$this->prepareMigrations($id_mappings);
$migrations = Migration::loadMultiple(['d6_term_node:*']);
array_walk($migrations, [$this, 'executeMigration']);
}
/**

View file

@ -71,6 +71,7 @@ abstract class MigrateTermNodeTestBase extends MigrateDrupal6TestBase {
'type' => 'story',
'nid' => $i,
'vid' => array_shift($vids),
'title' => $this->randomString(),
));
$node->enforceIsNew();
$node->save();
@ -82,17 +83,6 @@ abstract class MigrateTermNodeTestBase extends MigrateDrupal6TestBase {
$node->save();
}
}
$this->loadDumps([
'Node.php',
'NodeRevisions.php',
'ContentTypeStory.php',
'ContentTypeTestPlanet.php',
'TermNode.php',
'TermHierarchy.php',
'TermData.php',
'Vocabulary.php',
'VocabularyNodeTypes.php',
]);
}
}

View file

@ -12,7 +12,7 @@ use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* Vocabulary entity display migration.
*
* @group taxonomy
* @group migrate_drupal_6
*/
class MigrateVocabularyEntityDisplayTest extends MigrateDrupal6TestBase {
@ -69,8 +69,6 @@ class MigrateVocabularyEntityDisplayTest extends MigrateDrupal6TestBase {
)
);
$this->prepareMigrations($id_mappings);
$this->loadDumps(['Vocabulary.php', 'VocabularyNodeTypes.php']);
$this->executeMigration('d6_vocabulary_entity_display');
}

View file

@ -12,7 +12,7 @@ use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* Vocabulary entity form display migration.
*
* @group taxonomy
* @group migrate_drupal_6
*/
class MigrateVocabularyEntityFormDisplayTest extends MigrateDrupal6TestBase {
@ -69,8 +69,6 @@ class MigrateVocabularyEntityFormDisplayTest extends MigrateDrupal6TestBase {
)
);
$this->prepareMigrations($id_mappings);
$this->loadDumps(['Vocabulary.php', 'VocabularyNodeTypes.php']);
$this->executeMigration('d6_vocabulary_entity_form_display');
}

View file

@ -14,7 +14,7 @@ use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* Vocabulary field instance migration.
*
* @group taxonomy
* @group migrate_drupal_6
*/
class MigrateVocabularyFieldInstanceTest extends MigrateDrupal6TestBase {
@ -68,7 +68,6 @@ class MigrateVocabularyFieldInstanceTest extends MigrateDrupal6TestBase {
),
))->save();
$this->loadDumps(['Vocabulary.php', 'VocabularyNodeTypes.php']);
$this->executeMigration('d6_vocabulary_field_instance');
}

View file

@ -13,7 +13,7 @@ use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* Vocabulary field migration.
*
* @group taxonomy
* @group migrate_drupal_6
*/
class MigrateVocabularyFieldTest extends MigrateDrupal6TestBase {
@ -44,7 +44,6 @@ class MigrateVocabularyFieldTest extends MigrateDrupal6TestBase {
'vid' => 'test_vocab',
))->save();
$this->loadDumps(['Vocabulary.php', 'VocabularyNodeTypes.php']);
$this->executeMigration('d6_vocabulary_field');
}

View file

@ -35,8 +35,22 @@ class TermTest extends TaxonomyTestBase {
*/
protected $field;
/**
* Modules to enable.
*
* @var string[]
*/
public static $modules = ['block'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->drupalPlaceBlock('local_actions_block');
$this->drupalPlaceBlock('local_tasks_block');
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy', 'bypass node access']));
$this->vocabulary = $this->createVocabulary();
@ -308,10 +322,7 @@ class TermTest extends TaxonomyTestBase {
// Submitting a term takes us to the add page; we need the List page.
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
// Test edit link as accessed from Taxonomy administration pages.
// Because Simpletest creates its own database when running tests, we know
// the first edit link found on the listing page is to our term.
$this->clickLink(t('Edit'), 1);
$this->clickLink(t('Edit'));
$this->assertRaw($edit['name[0][value]'], 'The randomly generated term name is present.');
$this->assertText($edit['description[0][value]'], 'The randomly generated term description is present.');
@ -339,12 +350,12 @@ class TermTest extends TaxonomyTestBase {
$this->assertText($edit['description[0][value]'], 'The randomly generated term description is present.');
// Did this page request display a 'term-listing-heading'?
$this->assertTrue($this->xpath('//div[contains(@class, "field-taxonomy-term--description")]'), 'Term page displayed the term description element.');
$this->assertTrue($this->xpath('//div[contains(@class, "field--name-description")]'), 'Term page displayed the term description element.');
// Check that it does NOT show a description when description is blank.
$term->setDescription(NULL);
$term->save();
$this->drupalGet('taxonomy/term/' . $term->id());
$this->assertFalse($this->xpath('//div[contains(@class, "field-taxonomy-term--description")]'), 'Term page did not display the term description when description was blank.');
$this->assertFalse($this->xpath('//div[contains(@class, "field--entity-taxonomy-term--description")]'), 'Term page did not display the term description when description was blank.');
// Check that the description value is processed.
$value = $this->randomMachineName();

View file

@ -7,7 +7,7 @@
namespace Drupal\taxonomy\Tests;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Render\BubbleableMetadata;
@ -86,13 +86,13 @@ class TokenReplaceTest extends TaxonomyTestBase {
// Generate and test sanitized tokens for term1.
$tests = array();
$tests['[term:tid]'] = $term1->id();
$tests['[term:name]'] = SafeMarkup::checkPlain($term1->getName());
$tests['[term:name]'] = Html::escape($term1->getName());
$tests['[term:description]'] = $term1->description->processed;
$tests['[term:url]'] = $term1->url('canonical', array('absolute' => TRUE));
$tests['[term:node-count]'] = 0;
$tests['[term:parent:name]'] = '[term:parent:name]';
$tests['[term:vocabulary:name]'] = SafeMarkup::checkPlain($this->vocabulary->label());
$tests['[term:vocabulary]'] = SafeMarkup::checkPlain($this->vocabulary->label());
$tests['[term:vocabulary:name]'] = Html::escape($this->vocabulary->label());
$tests['[term:vocabulary]'] = Html::escape($this->vocabulary->label());
$base_bubbleable_metadata = BubbleableMetadata::createFromObject($term1);
@ -117,14 +117,14 @@ class TokenReplaceTest extends TaxonomyTestBase {
// Generate and test sanitized tokens for term2.
$tests = array();
$tests['[term:tid]'] = $term2->id();
$tests['[term:name]'] = SafeMarkup::checkPlain($term2->getName());
$tests['[term:name]'] = Html::escape($term2->getName());
$tests['[term:description]'] = $term2->description->processed;
$tests['[term:url]'] = $term2->url('canonical', array('absolute' => TRUE));
$tests['[term:node-count]'] = 1;
$tests['[term:parent:name]'] = SafeMarkup::checkPlain($term1->getName());
$tests['[term:parent:name]'] = Html::escape($term1->getName());
$tests['[term:parent:url]'] = $term1->url('canonical', array('absolute' => TRUE));
$tests['[term:parent:parent:name]'] = '[term:parent:parent:name]';
$tests['[term:vocabulary:name]'] = SafeMarkup::checkPlain($this->vocabulary->label());
$tests['[term:vocabulary:name]'] = Html::escape($this->vocabulary->label());
// Test to make sure that we generated something for each token.
$this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
@ -148,7 +148,7 @@ class TokenReplaceTest extends TaxonomyTestBase {
// Generate and test sanitized tokens.
$tests = array();
$tests['[vocabulary:vid]'] = $this->vocabulary->id();
$tests['[vocabulary:name]'] = SafeMarkup::checkPlain($this->vocabulary->label());
$tests['[vocabulary:name]'] = Html::escape($this->vocabulary->label());
$tests['[vocabulary:description]'] = Xss::filter($this->vocabulary->getDescription());
$tests['[vocabulary:node-count]'] = 1;
$tests['[vocabulary:term-count]'] = 2;

View file

@ -8,6 +8,7 @@
namespace Drupal\taxonomy\Tests\Views;
use Drupal\views\Views;
use Drupal\taxonomy\Entity\Vocabulary;
/**
* Tests the "All terms" taxonomy term field handler.
@ -23,7 +24,10 @@ class TaxonomyFieldAllTermsTest extends TaxonomyTestBase {
*/
public static $testViews = array('taxonomy_all_terms_test');
function testViewsHandlerAllTermsField() {
/**
* Tests the "all terms" field handler.
*/
public function testViewsHandlerAllTermsField() {
$view = Views::getView('taxonomy_all_terms_test');
$this->executeView($view);
$this->drupalGet('taxonomy_all_terms_test');
@ -39,4 +43,28 @@ class TaxonomyFieldAllTermsTest extends TaxonomyTestBase {
$this->assertEqual($actual[1]->__toString(), $this->term2->label());
}
/**
* Tests token replacement in the "all terms" field handler.
*/
public function testViewsHandlerAllTermsWithTokens() {
$view = Views::getView('taxonomy_all_terms_test');
$this->drupalGet('taxonomy_all_terms_token_test');
// Term itself: {{ term_node_tid }}
$this->assertText('Term: ' . $this->term1->getName());
// The taxonomy term ID for the term: {{ term_node_tid__tid }}
$this->assertText('The taxonomy term ID for the term: ' . $this->term1->id());
// The taxonomy term name for the term: {{ term_node_tid__name }}
$this->assertText('The taxonomy term name for the term: ' . $this->term1->getName());
// The machine name for the vocabulary the term belongs to: {{ term_node_tid__vocabulary_vid }}
$this->assertText('The machine name for the vocabulary the term belongs to: ' . $this->term1->getVocabularyId());
// The name for the vocabulary the term belongs to: {{ term_node_tid__vocabulary }}
$vocabulary = Vocabulary::load($this->term1->bundle());
$this->assertText('The name for the vocabulary the term belongs to: ' . $vocabulary->label());
}
}

View file

@ -29,6 +29,7 @@ class VocabularyUiTest extends TaxonomyTestBase {
parent::setUp();
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy']));
$this->vocabulary = $this->createVocabulary();
$this->drupalPlaceBlock('local_actions_block');
}
/**