setupQueryTagTestHooks example

for ($i = 0; $i < 5; $i++) {
      $terms[$i] = $this->createTerm($vocabulary);
    }

    // Set up hierarchy. Term 2 is a child of 1.     $terms[2]->parent = $terms[1]->id();
    $terms[2]->save();

    /** @var \Drupal\taxonomy\TermStorageInterface $term_storage */
    $term_storage = $this->container->get('entity_type.manager')->getStorage('taxonomy_term');

    $this->setupQueryTagTestHooks();
    $loaded_term = $term_storage->load($terms[0]->id());
    // First term was loaded.     $this->assertEquals($terms[0]->id()$loaded_term->id());
    // TermStorage::load().     $this->assertQueryTagTestResult(1, 0);

    $this->setupQueryTagTestHooks();
    $loaded_terms = $term_storage->loadTree($vocabulary->id());
    // All terms were loaded.     $this->assertCount(5, $loaded_terms);
    // TermStorage::loadTree().
Home | Imprint | This part of the site doesn't use cookies.