adds tests for terms
This commit is contained in:
parent
566292eebd
commit
1422887696
|
@ -51,11 +51,11 @@ class Term extends Entity {
|
|||
}
|
||||
}
|
||||
|
||||
public function __toString(){
|
||||
return apply_filters("tainacan-term-to-string", $this->get_name(), $this);
|
||||
public function __toString() {
|
||||
return (string) apply_filters("tainacan-term-to-string", $this->get_name(), $this);
|
||||
}
|
||||
|
||||
public function _toArray(){
|
||||
public function _toArray() {
|
||||
$term_array = parent::_toArray();
|
||||
|
||||
$term_id = $term_array['term_id'];
|
||||
|
|
|
@ -21,6 +21,7 @@ class HTML_Injection extends TAINACAN_UnitTestCase
|
|||
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
|
||||
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
|
||||
$Tainacan_Taxonomies = \Tainacan\Repositories\Taxonomies::get_instance();
|
||||
$Tainacan_Terms = \Tainacan\Repositories\Terms::get_instance();
|
||||
|
||||
// Evil attempts
|
||||
$link = "<a href='www.tainacan.org'>link</a>";
|
||||
|
@ -128,6 +129,17 @@ class HTML_Injection extends TAINACAN_UnitTestCase
|
|||
/*
|
||||
* Test terms
|
||||
*/
|
||||
$term = $this->tainacan_entity_factory->create_entity(
|
||||
'term',
|
||||
array(
|
||||
'taxonomy' => $taxonomy->get_db_identifier(),
|
||||
'name' => $css,
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
$t = $Tainacan_Terms->fetch($term->get_term_id(), $taxonomy);
|
||||
$this->assertEquals($t->get_name(), 'my text along with some style');
|
||||
|
||||
/*
|
||||
* Test taxonomies
|
||||
|
|
Loading…
Reference in New Issue