Chris@17: drupalLogin($this->drupalCreateUser(['administer taxonomy', 'bypass node access'])); Chris@17: $this->vocabulary = $this->createVocabulary(); Chris@17: } Chris@17: Chris@17: /** Chris@17: * Tests term indentation. Chris@17: */ Chris@17: public function testTermIndentation() { Chris@17: $assert = $this->assertSession(); Chris@17: // Create three taxonomy terms. Chris@17: $term1 = $this->createTerm($this->vocabulary); Chris@17: $term2 = $this->createTerm($this->vocabulary); Chris@17: $term3 = $this->createTerm($this->vocabulary); Chris@17: Chris@17: // Get the taxonomy storage. Chris@17: $taxonomy_storage = $this->container->get('entity.manager')->getStorage('taxonomy_term'); Chris@17: Chris@17: // Indent the second term under the first one. Chris@17: $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->get('vid') . '/overview'); Chris@17: $hidden_edit = [ Chris@17: 'terms[tid:' . $term2->id() . ':0][term][tid]' => 2, Chris@17: 'terms[tid:' . $term2->id() . ':0][term][parent]' => 1, Chris@17: 'terms[tid:' . $term2->id() . ':0][term][depth]' => 1, Chris@17: ]; Chris@17: // Because we can't post hidden form elements, we have to change them in Chris@17: // code here, and then submit. Chris@17: foreach ($hidden_edit as $field => $value) { Chris@17: $node = $assert->hiddenFieldExists($field); Chris@17: $node->setValue($value); Chris@17: } Chris@17: $edit = [ Chris@17: 'terms[tid:' . $term2->id() . ':0][weight]' => 1, Chris@17: ]; Chris@17: // Submit the edited form and check for HTML indentation element presence. Chris@17: $this->drupalPostForm(NULL, $edit, t('Save')); Chris@17: $this->assertPattern('|