assertQueryTagTestResult example

    $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().     $this->assertQueryTagTestResult(1, 1);

    $this->setupQueryTagTestHooks();
    $loaded_terms = $term_storage->loadParents($terms[2]->id());
    // All parent terms were loaded.
Home | Imprint | This part of the site doesn't use cookies.