finishes first tests for taxonomy meta html

This commit is contained in:
Rodrigo de Oliveira 2021-04-06 09:41:32 -03:00
parent 7e7c36d60b
commit d7637bde12
4 changed files with 16 additions and 23 deletions

View File

@ -323,7 +323,6 @@ class Taxonomy extends Metadata_Type {
}
return $valid;
}
/**
@ -332,7 +331,7 @@ class Taxonomy extends Metadata_Type {
* @return string The HTML representation of the value, containing one or multiple terms, separated by comma, linked to term page
*/
public function get_value_as_html(Item_Metadata_Entity $item_metadata) {
$value = $item_metadata->get_value();
$value = $item_metadata->get_value();
$return = '';
if ( $item_metadata->is_multiple() ) {

View File

@ -1154,8 +1154,6 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
]);
$this->assertEquals(7, $bulk->count_posts());
}
/**
@ -1206,8 +1204,6 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
$item_id = $bulk->get_item_id_by_index(30);
$this->assertFalse($item_id);
}
function test_set_multiple_tax_meta() {
@ -1228,14 +1224,8 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
'collection_id' => $this->collection->get_id()
]);
$bulk->set_value($this->category, ['super', 'dooper']);
$items = $Tainacan_Items->fetch([
'tax_query' => [
[
@ -1342,6 +1332,4 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
$this->assertEquals(5, $items->found_posts);
}
}

View File

@ -79,10 +79,6 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
true
);
$term = $this->tainacan_entity_factory->create_entity(
'term',
array(
@ -237,10 +233,6 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
);
$this->assertContains($tax3->get_db_identifier(), get_object_taxonomies($collection->get_db_identifier()), 'Taxonommy used by repository level metadatum must be assigned to all collections post types');
}
function test_relate_taxonomy_match() {

View File

@ -671,7 +671,16 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
true
);
$meta = $this->tainacan_entity_factory->create_entity(
$term = $this->tainacan_entity_factory->create_entity(
'term',
array(
'taxonomy' => $taxonomy->get_db_identifier(),
'name' => 'first term from my tax',
),
true
);
$taxonomy_meta = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'My tax meta',
@ -684,5 +693,10 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
),
true
);
$item_taxonomy_metadata = new \Tainacan\Entities\Item_Metadata_Entity($this->item, $taxonomy_meta);
$item_taxonomy_metadata->set_value($term);
$item_taxonomy_metadata->validate();
$this->assertEquals($item_taxonomy_metadata->get_value_as_html(), "<a data-linkto='term' data-id='2' href='http://example.org/?tnc_tax_273=first-term-from-my-tax'>first term from my tax</a>");
}
}