test: create attribute html href with term link #396

This commit is contained in:
vnmedeiros 2021-04-09 12:00:44 -03:00
parent c1fab38a0d
commit 9fe6446a23
1 changed files with 5 additions and 2 deletions

View File

@ -706,14 +706,17 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
$item_taxonomy_metadata->set_value($term);
$item_taxonomy_metadata->validate();
$term_id = $term->get_id();
$this->assertEquals($item_taxonomy_metadata->get_value_as_html(), "<a data-linkto='term' data-id='{$term_id}' href='http://example.org/?tnc_tax_273=first-term-from-my-tax'>first term from my tax</a>");
$link = get_term_link( (int) $term_id );
$this->assertEquals($item_taxonomy_metadata->get_value_as_html(), "<a data-linkto='term' data-id='{$term_id}' href='{$link}'>first term from my tax</a>");
$taxonomy_meta->set_multiple('yes');
$item_taxonomy_metadata->set_value([ $term, $term2 ]);
$item_taxonomy_metadata->validate();
$term_id = $term->get_id();
$term_id2 = $term2->get_id();
$this->assertEquals($item_taxonomy_metadata->get_value_as_html(), "<a data-linkto='term' data-id='{$term_id}' href='http://example.org/?tnc_tax_273=first-term-from-my-tax'>first term from my tax</a><span class=\"multivalue-separator\"> | </span><a data-linkto='term' data-id='{$term_id2}' href='http://example.org/?tnc_tax_273=second-term-from-my-tax'>Second term from my tax</a>");
$link = get_term_link( (int) $term_id );
$link2 = get_term_link( (int) $term_id2 );
$this->assertEquals($item_taxonomy_metadata->get_value_as_html(), "<a data-linkto='term' data-id='{$term_id}' href='{$link}'>first term from my tax</a><span class=\"multivalue-separator\"> | </span><a data-linkto='term' data-id='{$term_id2}' href='{$link2}'>Second term from my tax</a>");
}
function test_compound_metadata_html() {