test: create attribute html href with term link #396
This commit is contained in:
parent
c1fab38a0d
commit
9fe6446a23
|
@ -706,14 +706,17 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
|
||||||
$item_taxonomy_metadata->set_value($term);
|
$item_taxonomy_metadata->set_value($term);
|
||||||
$item_taxonomy_metadata->validate();
|
$item_taxonomy_metadata->validate();
|
||||||
$term_id = $term->get_id();
|
$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');
|
$taxonomy_meta->set_multiple('yes');
|
||||||
$item_taxonomy_metadata->set_value([ $term, $term2 ]);
|
$item_taxonomy_metadata->set_value([ $term, $term2 ]);
|
||||||
$item_taxonomy_metadata->validate();
|
$item_taxonomy_metadata->validate();
|
||||||
$term_id = $term->get_id();
|
$term_id = $term->get_id();
|
||||||
$term_id2 = $term2->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() {
|
function test_compound_metadata_html() {
|
||||||
|
|
Loading…
Reference in New Issue