link";
$js = "";
$css = "my text along with some style ";
$iframe = "";
// Accepted formatting
$strong = "I have some info to tell the world. And I can bold it ";
$html = "
Main Info
sub title
My structure description
and another paragraph
";
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'collection name link link2 ',
'description' => 'collection description',
),
true
);
$collection = $Tainacan_Collections->fetch($collection->get_id());
// $this->assertEquals($collection->get_name(), 'collection name link link2');
$metadatum = $this->tainacan_entity_factory->create_entity(
'metadatum',
array(
'name' => 'metadatum name link',
'description' => 'metadatum description',
'collection' => $collection,
'metadata_type' => 'Tainacan\Metadata_Types\Text',
),
true
);
$metadatum = $Tainacan_Metadata->fetch($metadatum->get_id());
// $this->assertEquals($metadatum->get_name(), 'metadatum name link');
$item = $this->tainacan_entity_factory->create_entity(
'item',
array(
'title' => 'title item ',
'description' => 'description item ',
'collection' => $collection
),
true
);
$item = $Tainacan_Items->fetch($item->get_id());
// $this->assertEquals($item->get_title(), 'title item console.log("XSS")');
// $this->assertEquals($item->get_description(), 'description item');
// Test metadata
$item_metadata = new \Tainacan\Entities\Item_Metadata_Entity($item, $metadatum);
$item_metadata->set_value($js);
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->insert($item_metadata);
$this->assertEquals($item_metadata->get_value(), "alert('XSS')");
$item_metadata->set_value($link);
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->update($item_metadata);
$this->assertEquals($item_metadata->get_value(), 'link');
$item_metadata->set_value($css);
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->update($item_metadata);
$this->assertEquals($item_metadata->get_value(), 'my text along with some style a { display: none }');
$item_metadata->set_value($iframe);
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->update($item_metadata);
$this->assertEquals($item_metadata->get_value(), '');
$item_metadata->set_value($strong);
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->update($item_metadata);
$this->assertEquals($item_metadata->get_value(), $strong);
$item_metadata->set_value($html);
$item_metadata->validate();
$item_metadata = $Tainacan_Item_Metadata->update($item_metadata);
$this->assertEquals($item_metadata->get_value(), $html);
// Test terms
}
}