Update to Drupal 8.1.2. For more information, see https://www.drupal.org/project/drupal/releases/8.1.2

This commit is contained in:
Pantheon Automation 2016-06-02 15:56:09 -07:00 committed by Greg Anderson
parent 9eae24d844
commit 28556d630e
1322 changed files with 6699 additions and 2064 deletions

View file

@ -9,7 +9,7 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\taxonomy\VocabularyInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/*
/**
* Provides terms overview form for a taxonomy vocabulary.
*/
class OverviewTerms extends FormBase {

View file

@ -191,10 +191,10 @@ class Tid extends ArgumentDefaultPluginBase implements CacheableDependencyInterf
$taxonomy = array();
foreach ($node->getFieldDefinitions() as $field) {
if ($field->getType() == 'entity_reference' && $field->getSetting('target_type') == 'taxonomy_term') {
foreach ($node->get($field->getName()) as $item) {
if (($handler_settings = $field->getSetting('handler_settings')) && isset($handler_settings['target_bundles'])) {
$taxonomy[$item->target_id] = reset($handler_settings['target_bundles']);
}
$taxonomy_terms = $node->{$field->getName()}->referencedEntities();
/** @var \Drupal\taxonomy\TermInterface $taxonomy_term */
foreach ($taxonomy_terms as $taxonomy_term) {
$taxonomy[$taxonomy_term->id()] = $taxonomy_term->getVocabularyId();
}
}
}

View file

@ -28,4 +28,5 @@ class Term extends Entity {
}
}
}
}

View file

@ -22,7 +22,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class TaxonomyIndexTid extends ManyToOne {
// Stores the exposed input for this filter.
var $validated_exposed_input = NULL;
public $validated_exposed_input = NULL;
/**
* The vocabulary storage.
@ -322,7 +322,7 @@ class TaxonomyIndexTid extends ManyToOne {
// We only validate if they've chosen the text field style.
if ($this->options['type'] != 'textfield') {
if ($form_state->getValue($identifier) != 'All') {
if ($form_state->getValue($identifier) != 'All') {
$this->validated_exposed_input = (array) $form_state->getValue($identifier);
}
return;

View file

@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* @ViewsRelationship("node_term_data")
*/
class NodeTermData extends RelationshipPluginBase {
class NodeTermData extends RelationshipPluginBase {
/**
* The vocabulary storage.

View file

@ -24,7 +24,7 @@ class TermTranslationHandler extends ContentTranslationHandler {
*
* This handles the save action.
*
* @see \Drupal\Core\Entity\EntityForm::build().
* @see \Drupal\Core\Entity\EntityForm::build()
*/
function entityFormSave(array $form, FormStateInterface $form_state) {
if ($this->getSourceLangcode($form_state)) {

View file

@ -65,4 +65,5 @@ class EfqTest extends TaxonomyTestBase {
$term = _field_create_entity_from_ids($ids);
$this->assertEqual($term->id(), $tid, 'Taxonomy term can be created based on the IDs.');
}
}

View file

@ -58,4 +58,5 @@ class LoadMultipleTest extends TaxonomyTestBase {
$loaded_term = reset($loaded_terms);
$this->assertEqual($term->id(), $loaded_term->id(), 'Term loaded by name successfully.');
}
}

View file

@ -126,4 +126,5 @@ class RssTest extends TaxonomyTestBase {
$this->drupalGet('taxonomy/term/all/feed');
$this->assertNoRaw($raw_xml);
}
}

View file

@ -75,7 +75,7 @@ class TaxonomyImageTest extends TaxonomyTestBase {
$image = array_pop($files);
$edit['name[0][value]'] = $this->randomMachineName();
$edit['files[field_test_0]'] = drupal_realpath($image->uri);
$this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/add', $edit, t('Save'));
$this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/add', $edit, t('Save'));
$this->drupalPostForm(NULL, ['field_test[0][alt]' => $this->randomMachineName()], t('Save'));
$terms = entity_load_multiple_by_properties('taxonomy_term', array('name' => $edit['name[0][value]']));
$term = reset($terms);

View file

@ -32,4 +32,5 @@ abstract class TaxonomyTestBase extends WebTestBase {
$this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
}
}
}

View file

@ -56,4 +56,5 @@ trait TaxonomyTestTrait {
$term->save();
return $term;
}
}

View file

@ -75,4 +75,5 @@ class TermEntityReferenceTest extends TaxonomyTestBase {
$this->assertIdentical($result, $expected_result, 'Terms selection restricted to a single vocabulary.');
}
}

View file

@ -210,4 +210,5 @@ class TermIndexTest extends TaxonomyTestBase {
// language from being added to the options.
$this->assertRaw(\Drupal::l($term2->getName(), $term2->urlInfo('canonical', ['language' => NULL])), 'Parent term link is displayed when viewing the node.');
}
}

View file

@ -106,4 +106,5 @@ class TermLanguageTest extends TaxonomyTestBase {
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/add');
$this->assertOptionSelected('edit-langcode-0-value', 'cc', "The expected langcode, 'cc', was selected.");
}
}

View file

@ -225,10 +225,10 @@ class TermTest extends TaxonomyTestBase {
// three letters.
// @see https://www.drupal.org/node/2397691
$terms = array(
'term1' => 'a'. $this->randomMachineName(),
'term2' => 'b'. $this->randomMachineName(),
'term3' => 'c'. $this->randomMachineName() . ', ' . $this->randomMachineName(),
'term4' => 'd'. $this->randomMachineName(),
'term1' => 'a' . $this->randomMachineName(),
'term2' => 'b' . $this->randomMachineName(),
'term3' => 'c' . $this->randomMachineName() . ', ' . $this->randomMachineName(),
'term4' => 'd' . $this->randomMachineName(),
);
$edit = array();

View file

@ -124,7 +124,7 @@ class TermTranslationUITest extends ContentTranslationUITestBase {
$untranslatable_tid = $this->createEntity($values, $this->langcodes[0], $untranslatable_vocabulary->id());
// Verify translation links.
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
$this->assertResponse(200, 'The translatable vocabulary page was found.');
$this->assertLinkByHref('term/' . $translatable_tid . '/translations', 0, 'The translations link exists for a translatable vocabulary.');
$this->assertLinkByHref('term/' . $translatable_tid . '/edit', 0, 'The edit link exists for a translatable vocabulary.');

View file

@ -45,4 +45,5 @@ class ThemeTest extends TaxonomyTestBase {
$this->drupalGet('taxonomy/term/' . $term->id() . '/edit');
$this->assertRaw('seven/css/base/elements.css', t("The administrative theme's CSS appears on the page for editing a taxonomy term."));
}
}

View file

@ -143,4 +143,5 @@ class TokenReplaceTest extends TaxonomyTestBase {
$this->assertEqual($output, $expected, format_string('Sanitized taxonomy vocabulary token %token replaced.', array('%token' => $input)));
}
}
}

View file

@ -37,4 +37,5 @@ class RelationshipRepresentativeNodeTest extends TaxonomyTestBase {
);
$this->assertIdenticalResultset($view, $expected_result, $map);
}
}

View file

@ -2,6 +2,7 @@
namespace Drupal\taxonomy\Tests\Views;
use Drupal\field\Entity\FieldConfig;
use Drupal\views\Views;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
@ -30,6 +31,38 @@ class TaxonomyDefaultArgumentTest extends TaxonomyTestBase {
$request->server->set('SCRIPT_NAME', $GLOBALS['base_path'] . 'index.php');
$request->server->set('SCRIPT_FILENAME', 'index.php');
$response = $this->container->get('http_kernel')
->handle($request, HttpKernelInterface::SUB_REQUEST);
$view->setRequest($request);
$view->setResponse($response);
$view->initHandlers();
$expected = implode(',', array($this->term1->id(), $this->term2->id()));
$this->assertEqual($expected, $view->argument['tid']->getDefaultArgument());
$view->destroy();
}
public function testNodePathWithViewSelection() {
// Change the term entity reference field to use a view as selection plugin.
\Drupal::service('module_installer')->install(['entity_reference_test']);
$field_name = 'field_' . $this->vocabulary->id();
$field = FieldConfig::loadByName('node', 'article', $field_name);
$field->setSetting('handler', 'views');
$field->setSetting('handler_settings', [
'view' => [
'view_name' => 'test_entity_reference',
'display_name' => 'entity_reference_1',
],
]);
$field->save();
$view = Views::getView('taxonomy_default_argument_test');
$request = Request::create($this->nodes[0]->url());
$request->server->set('SCRIPT_NAME', $GLOBALS['base_path'] . 'index.php');
$request->server->set('SCRIPT_FILENAME', 'index.php');
$response = $this->container->get('http_kernel')->handle($request, HttpKernelInterface::SUB_REQUEST);
$view->setRequest($request);
$view->setResponse($response);
@ -60,7 +93,7 @@ class TaxonomyDefaultArgumentTest extends TaxonomyTestBase {
*/
public function testTermTitleEscaping() {
$this->term1->setName('<em>Markup</em>')->save();
$this->drupalGet('taxonomy_default_argument_test/'. $this->term1->id());
$this->drupalGet('taxonomy_default_argument_test/' . $this->term1->id());
$this->assertEscaped($this->term1->label());
}

View file

@ -61,7 +61,7 @@ class TaxonomyFieldAllTermsTest extends TaxonomyTestBase {
// 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());
$this->assertText('The name for the vocabulary the term belongs to: ' . $vocabulary->label());
}
}

View file

@ -178,4 +178,5 @@ class VocabularyCrudTest extends TaxonomyTestBase {
FieldStorageConfig::create($storage_definition)->save();
FieldConfig::create($field_definition)->save();
}
}

View file

@ -121,4 +121,5 @@ class VocabularyLanguageTest extends TaxonomyTestBase {
$this->assertEqual($new_settings->getDefaultLangcode(), 'authors_default', 'The langcode was saved.');
$this->assertFalse($new_settings->isLanguageAlterable(), 'The new visibility setting was saved.');
}
}

View file

@ -124,4 +124,5 @@ class VocabularyPermissionsTest extends TaxonomyTestBase {
$this->drupalGet('taxonomy/term/' . $term->id() . '/delete');
$this->assertResponse(403, 'Delete taxonomy term form open failed.');
}
}

View file

@ -153,4 +153,5 @@ class VocabularyUiTest extends TaxonomyTestBase {
$this->container->get('entity.manager')->getStorage('taxonomy_vocabulary')->resetCache();
$this->assertFalse(Vocabulary::load($vid), 'Vocabulary not found.');
}
}

View file

@ -38,4 +38,5 @@ interface VocabularyInterface extends ConfigEntityInterface {
* The vocabulary description.
*/
public function getDescription();
}

View file

@ -326,7 +326,7 @@ function taxonomy_term_load_multiple_by_name($name, $vocabulary = NULL) {
$values = array('name' => trim($name));
if (isset($vocabulary)) {
$vocabularies = taxonomy_vocabulary_get_names();
if (isset($vocabularies[$vocabulary])){
if (isset($vocabularies[$vocabulary])) {
$values['vid'] = $vocabulary;
}
else {

View file

@ -82,4 +82,5 @@ class MigrateTaxonomyTermStubTest extends MigrateDrupalTestBase {
$this->assertIdentical(count($stub_entity->validate()), 0, 'Stub is a valid entity');
}
}
}

View file

@ -148,4 +148,5 @@ class TermKernelTest extends KernelTestBase {
$ancestors = $storage->loadAllParents($term[3]->id());
$this->assertEqual(5, count($ancestors), 'The term has five ancestors including the term itself.');
}
}

View file

@ -64,4 +64,5 @@ class TermValidationTest extends EntityKernelTestBase {
$violations = $term->validate();
$this->assertEqual(count($violations), 0, 'No violations for parent id 0.');
}
}