Merge pull request #840 from tainacan/feature/791

feat: starts compatibility with php 8
This commit is contained in:
Vinícius Nunes Medeiros 2024-02-01 09:28:07 -03:00 committed by GitHub
commit 7a1546c166
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
49 changed files with 308 additions and 157 deletions

View File

@ -23,7 +23,7 @@ jobs:
matrix:
# Notes regarding supported versions in WP:
# The base matrix only contains the PHP versions which are supported on all supported WP versions.
php: ['7.0', '7.3', '7.4']
php: ['7.3', '7.4', '8.3']
wp: ['latest', '5.9']
experimental: [false]

View File

@ -11,8 +11,14 @@ use Tainacan\Entities;
*
* */
class REST_Background_Processes_Controller extends REST_Controller {
private $collections_repository;
private $collection;
/**
* table
*
* @var String
* @access protected
*/
private $table;
protected function get_schema() {
return "TODO:get_schema";
@ -181,7 +187,7 @@ class REST_Background_Processes_Controller extends REST_Controller {
$process_type = '';
if (isset($request['search'])) {
$name = $request['search'];
$process_type = "AND name LIKE '%${name}%'";
$process_type = "AND name LIKE '%$name%'";
$process_type = $wpdb->prepare($process_type);
}

View File

@ -19,7 +19,7 @@ class REST_Items_Controller extends REST_Controller {
private $metadatum_repository;
private $terms_repository;
private $filters_repository;
private $taxonomy_repository;
private $taxonomies_repository;
/**
* REST_Items_Controller constructor.
@ -587,7 +587,7 @@ class REST_Items_Controller extends REST_Controller {
}
$filter_name = is_string($filter_type_component)
? "tainacan-api-items-${filter_type_component}-filter-arguments"
? "tainacan-api-items-$filter_type_component-filter-arguments"
: 'tainacan-api-items-filter-arguments';
$filters_arguments[] = apply_filters($filter_name, array(
@ -1025,7 +1025,8 @@ class REST_Items_Controller extends REST_Controller {
'status' => 'draft'
];
$body = json_decode($request->get_body(), true);
$data_body = $request->get_body() ?? '';
$body = json_decode($data_body, true);
if (!is_array($body)) {
$body = [];
@ -1178,7 +1179,7 @@ class REST_Items_Controller extends REST_Controller {
}
return $new_term;
}
return count($split_value) > 1 ? $value : filter_var($value, FILTER_SANITIZE_STRING);
return count($split_value) > 1 ? $value : htmlspecialchars($value);
}
private function submission_rollback_new_terms () {
@ -1193,7 +1194,7 @@ class REST_Items_Controller extends REST_Controller {
$item = json_decode($request->get_body(), true);
$metadata = $item['metadata'];
foreach ($item as $key => $value) {
$item[$key] = ( is_string($value) && !is_numeric($value) ? filter_var($value, FILTER_SANITIZE_STRING) : $value );
$item[$key] = ( is_string($value) && !is_numeric($value) ? htmlspecialchars($value) : $value );
}
$response_recaptcha = $this->submission_item_check_recaptcha($request);
@ -1236,7 +1237,7 @@ class REST_Items_Controller extends REST_Controller {
$child_value = implode(' ', $child_value);
}
if (is_numeric($value) != true) {
$child_value = filter_var($child_value, FILTER_SANITIZE_STRING);
$child_value = htmlspecialchars($child_value);
}
$metadatum_child = $this->metadatum_repository->fetch( $child['metadatum_id'] );
$item_metadata_child = new Entities\Item_Metadata_Entity($item, $metadatum_child, null, $parent_meta_id);
@ -1258,7 +1259,7 @@ class REST_Items_Controller extends REST_Controller {
$child_value = implode(' ', $child_value);
}
if (is_numeric($value) != true) {
$child_value = filter_var($child_value, FILTER_SANITIZE_STRING);
$child_value = htmlspecialchars($child_value);
}
$metadatum_child = $this->metadatum_repository->fetch( $child['metadatum_id'] );
$item_metadata_child = new Entities\Item_Metadata_Entity($item, $metadatum_child, null, $parent_meta_id);
@ -1291,9 +1292,9 @@ class REST_Items_Controller extends REST_Controller {
}
} else {
if (is_array($value) == true) {
$value = array_map( function($v) { return is_numeric($v) ? $v : filter_var($v, FILTER_SANITIZE_STRING); }, $value);
$value = array_map( function($v) { return is_numeric($v) ? $v : htmlspecialchars($v); }, $value);
} else if (is_numeric($value) != true) {
$value = filter_var($value, FILTER_SANITIZE_STRING);
$value = htmlspecialchars($value);
}
if ($item_metadata->is_multiple()) {
$item_metadata->set_value( is_array($value) ? $value : [$value] );

View File

@ -6,8 +6,10 @@ use Tainacan\Repositories\Repository;
class Roles {
private static $instance = null;
private $capabilities;
private $meta_caps;
private $meta_section_caps;
private $filters_caps;
public static function get_instance()
{
@ -585,7 +587,7 @@ class Roles {
foreach ( $caps as $cap ) {
if ( array_key_exists($cap, $allcaps) && $allcaps[$cap] === true ) {
if ( isset($cap) && $cap !== false && array_key_exists($cap, $allcaps) && $allcaps[$cap] === true ) {
continue;
}

View File

@ -91,8 +91,8 @@ class Collection extends Entity {
$array_collection['header_image'] = $this->get_header_image();
$array_collection['author_name'] = $this->get_author_name();
$array_collection['url'] = $this->get_url();
$array_collection['creation_date'] = $this->get_date_i18n( explode( ' ', $array_collection['creation_date'] )[0] );
$array_collection['modification_date'] = $this->get_date_i18n( explode( ' ', $array_collection['modification_date'] )[0] );
$array_collection['creation_date'] = $this->get_date_i18n( explode( ' ', $array_collection['creation_date'] ?? '' )[0] );
$array_collection['modification_date'] = $this->get_date_i18n( explode( ' ', $array_collection['modification_date'] ?? '' )[0] );
return apply_filters('tainacan-collection-to-array', $array_collection, $this);
}

View File

@ -8,6 +8,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
* Entity Super class
*
*/
#[\AllowDynamicProperties]
class Entity {
/**
* The repository of that entity
@ -202,6 +203,9 @@ class Entity {
return $this->$method($value);
}
}
// public function __set(string $name, mixed $value): void {
// $this->{$name} = $value;
// }
/**
* get the value property
@ -216,6 +220,9 @@ class Entity {
return $this->$method();
}
}
// public function __get(string $name) {
// return $this->{$name};
// }
/**
* set the status of the entity

View File

@ -140,7 +140,7 @@ class Filter extends Entity {
function get_filter_type_object(){
$class_name = $this->get_filter_type();
if( !class_exists( $class_name ) ){
if( is_null($class_name) || !class_exists( $class_name ) ){
return null;
}

View File

@ -56,8 +56,8 @@ class Item extends Entity {
$array_item['_thumbnail_id'] = $this->get__thumbnail_id();
$array_item['author_name'] = $this->get_author_name();
$array_item['url'] = get_permalink( $this->get_id() );
$array_item['creation_date'] = $this->get_date_i18n( explode( ' ', $array_item['creation_date'] )[0] );
$array_item['modification_date'] = $this->get_date_i18n( explode( ' ', $array_item['modification_date'] )[0] );
$array_item['creation_date'] = $this->get_date_i18n( explode( ' ', $array_item['creation_date'] ?? '' )[0] );
$array_item['modification_date'] = $this->get_date_i18n( explode( ' ', $array_item['modification_date'] ?? '' )[0] );
$array_item['document_mimetype'] = $this->get_document_mimetype();
return apply_filters('tainacan-item-to-array', $array_item, $this);
}

View File

@ -8,6 +8,8 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
* Represents the Entity Term
*/
class Term extends Entity {
public $WP_Term;
protected
$term_id,
$name,

View File

@ -4,6 +4,14 @@ namespace Tainacan;
class Export_Handler {
/**
* bg_exporter
*
* @var Background_Exporter
* @access protected
*/
protected $bg_exporter;
private $registered_exporters = [];
function __construct() {

View File

@ -173,7 +173,8 @@ class Exposers_Handler {
* @return Exposers\Exposer|boolean false
*/
public static function request_has_exposer($request) {
$body = json_decode( $request->get_body(), true );
$data_body = $request->get_body() ?? '';
$body = json_decode( $data_body, true );
$query_url_params = $request->get_query_params();
$Tainacan_Exposers = self::get_instance();
if(

View File

@ -8,6 +8,11 @@ class Bulk_Edit_Process extends Generic_Process {
private $meta_key = '_tnc_bulk';
private $group_id = false;
private $items_repository;
private $metadatum_repository;
private $item_metadata_repository;
private $bulk_edit_data;
public function __construct($attributes = array()) {
$this->array_attributes = array_merge($this->array_attributes, [
'group_id',
@ -93,9 +98,9 @@ class Bulk_Edit_Process extends Generic_Process {
$metadata_label = __('Changed metadata', 'tainacan');
$message = __('Bulk edit finished', 'tainacan');
$message .= "<p> <strong> ${title_label}: </strong> ${name} </p>";
$message .= "<p> <strong> ${author_label}: </strong> ${author_name} </p>";
$message .= "<p> <strong> ${metadata_label}: </strong> ${metadata} </p>";
$message .= "<p> <strong> $title_label: </strong> $name </p>";
$message .= "<p> <strong> $author_label: </strong> $author_name </p>";
$message .= "<p> <strong> $metadata_label: </strong> $metadata </p>";
return $message;
}
@ -268,7 +273,7 @@ class Bulk_Edit_Process extends Generic_Process {
$serealize_erro = (object) array('err' => array());
$erro = $item_metadata->get_errors();
array_walk_recursive($erro, function($v, $k, &$t) {$t->err[] = $v;}, $serealize_erro);
array_walk_recursive($erro, function($v, $k, $t) {$t->err[] = $v;}, $serealize_erro);
$this->add_error_log( __('errors: ', 'tainacan') . implode(", ", $serealize_erro->err) );
return false;
@ -516,7 +521,13 @@ class Bulk_Edit_Process extends Generic_Process {
$this->add_error_log( sprintf( __( 'Please verify, invalid value(s) to edit item ID: "%d"', 'tainacan' ), $item->get_id() ) );
$serealize_erro = (object) array('err' => array());
array_walk_recursive($item->get_errors(), create_function('&$v, $k, &$t', '$t->err[] = $v;'), $serealize_erro);
array_walk_recursive(
$item->get_errors(),
function (&$v, $k, &$t) {
$t->err[] = $v;
},
$serealize_erro
);
$this->add_error_log( __('errors: ', 'tainacan') . implode(", ", $serealize_erro->err) );
return false;
@ -538,7 +549,12 @@ class Bulk_Edit_Process extends Generic_Process {
$this->add_error_log( sprintf( __( 'Please verify, invalid value(s) to edit item ID: "%d"', 'tainacan' ), $item->get_id() ) );
$serealize_erro = (object) array('err' => array());
array_walk_recursive($item->get_errors(), create_function('&$v, $k, &$t', '$t->err[] = $v;'), $serealize_erro);
array_walk_recursive(
$item->get_errors(),
function (&$v, $k, &$t) {
$t->err[] = $v;
},
$serealize_erro);
$this->add_error_log( __('errors: ', 'tainacan') . implode(", ", $serealize_erro->err) );
return false;

View File

@ -4,6 +4,15 @@ namespace Tainacan;
class Generic_Process_Handler {
/**
* bg_process
*
* @var Background_Generic_Process
* @access protected
*/
protected $bg_process;
private $registered_process = [];
function __construct() {

View File

@ -5,6 +5,8 @@ use Tainacan;
use Tainacan\Entities;
class CSV extends Importer {
private $items_repo;
public function __construct($attributes = array()) {
parent::__construct($attributes);
$this->items_repo = \Tainacan\Repositories\Items::get_instance();
@ -487,7 +489,7 @@ class CSV extends Importer {
case 'utf8':
return $string;
case 'iso88591':
return utf8_encode($string);
return mb_convert_encoding($string, 'UTF-8', 'ISO-8859-1');
default:
return $string;
}
@ -1089,11 +1091,11 @@ class CSV extends Importer {
$author = $current_user->user_login;
$message = __('imported file:', 'tainacan');
$message .= " <b> ${imported_file} </b><br/>";
$message .= " <b> $imported_file </b><br/>";
$message .= __('target collections:', 'tainacan');
$message .= " <b>" . implode(", ", $this->get_collections_names() ) . "</b><br/>";
$message .= __('Imported by:', 'tainacan');
$message .= " <b> ${author} </b><br/>";
$message .= " <b> $author </b><br/>";
return $message;
}

View File

@ -4,6 +4,14 @@ namespace Tainacan;
class Importer_Handler {
/**
* bg_importer
*
* @var Background_Importer
* @access protected
*/
protected $bg_importer;
private $registered_importers = [];
function __construct() {

View File

@ -3,7 +3,14 @@
namespace Tainacan\Importer;
use \Tainacan\Entities;
class Old_Tainacan extends Importer{
class Old_Tainacan extends Importer {
protected $tax_repo;
protected $col_repo;
protected $items_repo;
protected $metadata_repo;
protected $term_repo;
protected $item_metadata_repo;
protected $steps = [
[
@ -443,7 +450,7 @@ class Old_Tainacan extends Importer{
$info = $this->requester( $this->get_url() . $this->tainacan_api_address . "/collections/".$collection_id."/items", $args );
if( !isset($info['body']) ){
$this->add_error_log($result->get_error_message());
$this->add_error_log($info->get_error_message());
$this->add_error_log('Error in fetch remote total items');
$this->abort();
return false;
@ -474,7 +481,7 @@ class Old_Tainacan extends Importer{
$info = wp_remote_get( $this->get_url() . $this->tainacan_api_address . "/collections/".$collection_id."/items?includeMetadata=1&filter[page]=" . $page, $args );
if( !isset($info['body']) ){
$this->add_error_log($result->get_error_message());
$this->add_error_log($info->get_error_message());
$this->add_error_log('Error in fetch remote first page item');
$this->abort();
return false;
@ -493,7 +500,7 @@ class Old_Tainacan extends Importer{
$info = json_decode($info['body']);
if( !isset($info['body']) ){
$this->add_error_log($result->get_error_message());
$this->add_error_log($info->get_error_message());
$this->add_error_log('Error in fetch remote ' . $page . ' page item');
$this->abort();
return false;
@ -613,7 +620,7 @@ class Old_Tainacan extends Importer{
if (is_wp_error($result)) {
$this->add_log($result->get_error_message());
$this->add_log('Error in fetch remote' . $url);
$this->add_log('Error in fetch remote' . $link);
$this->add_log('request number ' . $requests);
} else if (isset($result['body'])){
@ -644,7 +651,7 @@ class Old_Tainacan extends Importer{
$this->add_error_log('Error in fetch remote, expired the 10 requests limit ' . $url);
$this->add_error_log('Error in fetch remote, expired the 10 requests limit ' . $link);
$this->abort();
return false;
}
@ -713,10 +720,9 @@ class Old_Tainacan extends Importer{
* @return int $metadatum_id
*/
protected function create_metadata( $node_metadata_old, $collection_id = null){
$this->add_log('Creating metadata' . $meta->name);
$newMetadatum = new Entities\Metadatum();
$meta = $node_metadata_old;
$this->add_log('Creating metadata' . $meta->name);
$name = $meta->name;
$type = $this->define_type($meta->type);
@ -856,7 +862,7 @@ class Old_Tainacan extends Importer{
/**
* create attachments, document and thumb from old
*
* @param string $node_old
* @param Object $node_old
*
* @return string the class name
*/

View File

@ -80,6 +80,12 @@ class Test_Importer extends Importer {
protected $extra_values = [
'extra val 1', 'extra val 2', 'extra val 3', 'extra val 4', 'extra val 5'
];
protected $tax_repo;
protected $col_repo;
protected $items_repo;
protected $metadata_repo;
protected $item_metadata_repo;
public function __construct($attributes = array()) {
parent::__construct($attributes);

View File

@ -51,6 +51,38 @@
*/
protected $cron_interval_identifier;
/**
* cron_hook_check_identifier
*
* @var string
* @access protected
*/
protected $cron_hook_check_identifier;
/**
* process_lock_in_time
*
* @var string
* @access protected
*/
protected $process_lock_in_time;
/**
* queue_lock_time
*
* @var string
* @access protected
*/
protected $queue_lock_time;
/**
* cron_interval
*
* @var string
* @access protected
*/
protected $cron_interval;
/**
* Initiate new background process
*/

View File

@ -137,7 +137,8 @@ class Mappers_Handler {
* @return Mappers\Mapper|boolean false
*/
public static function get_mapper_from_request($request) {
$body = json_decode( $request->get_body(), true );
$data_body = $request->get_body() ?? '';
$body = json_decode( $data_body, true );
$Tainacan_Mappers = self::get_instance();
$query_url_params = $request->get_query_params();

View File

@ -29,6 +29,10 @@ class OAIPMH_Expose {
var $token_valid;
var $token_prefix;
protected $collection_repository;
protected $item_repository;
protected $repositoryIdentifier;
/**
*
*/

View File

@ -19,6 +19,7 @@ class OAIPMH_List_Records extends OAIPMH_Expose {
public $until;
public $sets;
public $metadataPrefix;
/**
* @signature CONSTRUTOR
@ -186,7 +187,7 @@ class OAIPMH_List_Records extends OAIPMH_Expose {
$this->xml_creater->addChild($this->working_node, $key, '');
}
}
}catch(Exception $e){
}catch(\Exception $e){
var_dump($e,$this->working_node,'dc:' . $key);
}
}

View File

@ -13,6 +13,9 @@ class Collections extends Repository {
public $entities_type = '\Tainacan\Entities\Collection';
private static $instance = null;
private $old_collection;
private $old_core_title;
private $old_core_description;
public static function get_instance() {
if ( ! isset( self::$instance ) ) {

View File

@ -14,6 +14,7 @@ use \Respect\Validation\Validator as v;
class Metadata extends Repository {
public $entities_type = '\Tainacan\Entities\Metadatum';
protected $default_metadata = 'default';
protected $current_taxonomy;
public $metadata_types = [];
@ -1265,7 +1266,7 @@ class Metadata extends Repository {
}
$search_q = '';
$search = trim($args['search']);
$search = trim($args['search'] ?? '');
if (!empty($search)) {
if( $metadatum_type === 'Tainacan\Metadata_Types\Relationship' ) {
$search_q = $wpdb->prepare("AND meta_value IN ( SELECT ID FROM $wpdb->posts WHERE post_title LIKE %s )", '%' . $search . '%');
@ -1384,7 +1385,7 @@ class Metadata extends Repository {
}
}
$number = ctype_digit($args['number']) && $args['number'] >=1 ? $args['number'] : $total;
$number = ctype_digit((string)$args['number']) && $args['number'] >=1 ? $args['number'] : $total;
if( $number < 1){
$pages = 1;
} else {
@ -1401,8 +1402,10 @@ class Metadata extends Repository {
$total_items = null;
if ( $args['count_items'] ) {
$count_items_query = $args['items_filter'];
$count_items_query['posts_per_page'] = 1;
$count_items_query = array(
'posts_per_page' => 1
);
$count_items_query = array_merge($args['items_filter'] != false ? $args['items_filter'] : [], $count_items_query);
if ( !isset($count_items_query['tax_query']) ) {
$count_items_query['tax_query'] = [];
}
@ -1448,7 +1451,7 @@ class Metadata extends Repository {
$results = $wpdb->get_col($query);
$total = $wpdb->get_var($total_query);
$number = ctype_digit($args['number']) && $args['number'] >=1 ? $args['number'] : $total;
$number = ctype_digit((string)$args['number']) && $args['number'] >=1 ? $args['number'] : $total;
if( $number < 1){
$pages = 1;
} else {
@ -1485,7 +1488,7 @@ class Metadata extends Repository {
if ( $args['count_items'] ) {
$count_items_query = $args['items_filter'];
$count_items_query['posts_per_page'] = 1;
$count_items_query['posts_per_page'] = (int)1;
if ( !isset($count_items_query['meta_query']) ) {
$count_items_query['meta_query'] = [];
}

View File

@ -121,6 +121,7 @@ abstract class Repository {
* @throws \Exception
*/
public function insert( $obj ) {
$obj_post_type = $obj->get_post_type();
// validate
$required_validation_statuses = ['publish', 'future', 'private'];
if (in_array( $obj->get_status(), apply_filters( 'tainacan-status-require-validation', $required_validation_statuses) ) && ! $obj->get_validated() ) {
@ -173,6 +174,9 @@ abstract class Repository {
if ( ! $obj instanceof Entities\Log ) {
$obj->WP_Post->post_title = $sanitized_title;
$obj->WP_Post->post_content = $sanitized_desc;
} else {
$obj->WP_Post->post_title = $this->sanitize_value($obj->WP_Post->post_title);
$obj->WP_Post->post_content = $this->sanitize_value($obj->WP_Post->post_content);
}
$id = wp_insert_post( $obj->WP_Post );
@ -941,7 +945,10 @@ abstract class Repository {
}
protected function sanitize_value($content) {
if (is_numeric($content) || empty($content) ) {
if( $content == null ) {
return '';
}
if (is_numeric($content) || empty($content ) ) {
return $content;
}

View File

@ -14,6 +14,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
*/
trait Entity_Collection_Relation {
protected $collection;
/**
*
* @return int collection item ID

View File

@ -142,7 +142,8 @@ abstract class Filter_Type {
/**
* @param $options
*/
public function set_options( $options ){
public function set_options( $options ) {
$options = $options ?? '';
$this->options = ( is_array( $options ) ) ? $options : (!is_array(unserialize( $options )) ? [] : unserialize( $options ));
}

View File

@ -12,6 +12,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
class Date extends Metadata_Type {
private $format;
private $output_date_format;
function __construct() {
// call metadatum type constructor

View File

@ -174,8 +174,9 @@ abstract class Metadata_Type {
/**
* @param $options
*/
public function set_options( $options ){
$this->options = ( is_array( $options ) ) ? $options : (!is_array(unserialize( $options )) ? [] : unserialize( $options ));
public function set_options( $options ) {
$options = $options ?? '';
$this->options = ( is_array( $options ) ) ? $options : (!is_array(unserialize( $options )) ? [] : unserialize( $options ));
}
public function set_default_options(Array $options) {

View File

@ -77,7 +77,7 @@ class Admin {
);
$mobile_app_page_suffix = add_submenu_page(
null, // Mobile app page is not listed in the menu
'tainacan-no-show-menu', // Mobile app page is not listed in the menu
__('Mobile App', 'tainacan'),
__('Mobile App', 'tainacan'),
'manage_tainacan',
@ -204,39 +204,39 @@ class Admin {
wp_enqueue_style( 'roboto-fonts', 'https://fonts.googleapis.com/css?family=Roboto:400,400i,500,500i,700,700i', [] );
wp_enqueue_style( 'tainacan-admin-page', $TAINACAN_BASE_URL . '/assets/css/tainacan-admin.css', [], TAINACAN_VERSION );
// $undesired_wp_styles = [
// 'admin-menu',
// 'admin-bar',
// 'code-editor',
// 'color-picker',
// 'customize-controls',
// 'customize-nav-menus',
// 'customize-widgets',
// 'dashboard',
// 'dashicons',
// 'deprecated-media',
// 'edit',
// 'wp-pointer',
// 'farbtastic',
// 'forms',
// 'common',
// 'install',
// 'wp-auth-check',
// 'site-icon',
// 'buttons',
// 'l10n',
// 'list-tables',
// 'login',
// 'media',
// 'nav-menus',
// 'revisions',
// 'themes',
// 'widgets',
// 'wp-admin'
// ];
//
// wp_dequeue_style( $undesired_wp_styles );
// wp_deregister_style( $undesired_wp_styles );
// $undesired_wp_styles = [
// 'admin-menu',
// 'admin-bar',
// 'code-editor',
// 'color-picker',
// 'customize-controls',
// 'customize-nav-menus',
// 'customize-widgets',
// 'dashboard',
// 'dashicons',
// 'deprecated-media',
// 'edit',
// 'wp-pointer',
// 'farbtastic',
// 'forms',
// 'common',
// 'install',
// 'wp-auth-check',
// 'site-icon',
// 'buttons',
// 'l10n',
// 'list-tables',
// 'login',
// 'media',
// 'nav-menus',
// 'revisions',
// 'themes',
// 'widgets',
// 'wp-admin'
// ];
// wp_dequeue_style( $undesired_wp_styles );
// wp_deregister_style( $undesired_wp_styles );
}

View File

@ -20,7 +20,7 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
public $items_ids = [];
function setUp() {
function setUp(): void {
parent::setUp();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',

View File

@ -20,7 +20,15 @@ class TAINACAN_UnitApiTestCase extends TAINACAN_UnitTestCase {
*/
protected $namespace = '/tainacan/v2';
public function setUp(){
public $collection;
public $metadatum;
public $item;
public $multiple_meta;
public $taxonomy;
public $category;
public $api_baseroute;
public function setUp() : void{
parent::setUp();
global $wp_rest_server;

View File

@ -4,6 +4,7 @@ namespace Tainacan\Tests;
use Tainacan\Tests\Factories;
#[\AllowDynamicProperties]
class TAINACAN_UnitTestCase extends \WP_UnitTestCase {
protected $tainacan_entity_factory;
protected $tainacan_metadatum_factory;
@ -11,7 +12,7 @@ class TAINACAN_UnitTestCase extends \WP_UnitTestCase {
protected $tainacan_item_metadata_factory;
protected $user_id;
public function setUp(){
public function setUp(): void {
parent::setUp();
$this->tainacan_entity_factory = new Factories\Entity_Factory();
$this->tainacan_metadatum_factory = new Factories\Metadatum_Factory();

View File

@ -7,7 +7,10 @@ namespace Tainacan\Tests;
*/
class TAINACAN_REST_Compound_Metadata_Controller extends TAINACAN_UnitApiTestCase {
function setUp() {
public $collection;
public $item;
function setUp(): void {
parent::setUp();
$this->collection = $this->tainacan_entity_factory->create_entity(

View File

@ -6,8 +6,11 @@ namespace Tainacan\Tests;
* @group api
*/
class TAINACAN_REST_Items_Submission extends TAINACAN_UnitApiTestCase {
function setUp() {
private $col_user_anonymous;
private $col_user_logged;
private $collections_metadatum;
function setUp(): void {
parent::setUp();
// collections:

View File

@ -7,6 +7,9 @@ namespace Tainacan\Tests;
*/
class TAINACAN_REST_Metadatum_Mappers_Controller extends TAINACAN_UnitApiTestCase {
private $metadatum2;
private $metadatum3;
protected function create_meta_requirements() {
$collection = $this->tainacan_entity_factory->create_entity(
'collection',

View File

@ -7,6 +7,8 @@ namespace Tainacan\Tests;
*/
class TAINACAN_REST_Private_Files extends TAINACAN_UnitApiTestCase {
public $test_file;
public function test_create_item() {
$orig_file = './tests/attachment/codeispoetrywp.jpg';
@ -58,8 +60,7 @@ class TAINACAN_REST_Private_Files extends TAINACAN_UnitApiTestCase {
$attachment_data = wp_get_attachment_metadata($attachment->ID);
$folder = 'tainacan-items/' . $this->collection->get_id() . '/' . $this->item->get_id();
$this->assertContains( $folder, $attachment_data['file'] );
$this->assertStringStartsWith( $folder, $attachment_data['file'] );
}
function test_internal_api() {
@ -91,8 +92,7 @@ class TAINACAN_REST_Private_Files extends TAINACAN_UnitApiTestCase {
$attachment_id = \Tainacan\Media::get_instance()->insert_attachment_from_file($this->test_file, $this->item->get_id());
$attachment_data = wp_get_attachment_metadata($attachment_id);
$folder = 'tainacan-items/' . $this->collection->get_id() . '/' . $this->item->get_id();
$this->assertContains( $folder, $attachment_data['file'] );
$this->assertStringStartsWith( $folder, $attachment_data['file'] );
}
}

View File

@ -7,7 +7,7 @@ namespace Tainacan\Tests;
*
*/
class TAINACAN_REST_Roles_Controller extends TAINACAN_UnitApiTestCase {
public function setUp() {
public function setUp(): void {
parent::setUp();
// reset WP_Roles object. Possible bug was cleaning database between tests, but not the object
global $wpdb;

View File

@ -6,7 +6,7 @@ namespace Tainacan\Tests;
* @group api
* **/
class TAINACAN_REST_Search extends TAINACAN_UnitApiTestCase {
function setUp() {
function setUp(): void {
parent::setUp();
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();

View File

@ -10,8 +10,11 @@ use Tainacan\Entities;
class SequenceEdit extends TAINACAN_UnitApiTestCase {
public $items_ids = [];
public $collection;
public $metadatum;
public $api_baseroute;
function setUp() {
function setUp(): void {
parent::setUp();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',

View File

@ -31,7 +31,7 @@ class TAINACAN_REST_Visibilility_Controller extends TAINACAN_UnitApiTestCase {
public $term_public;
public $term_private;
function setUp() {
function setUp(): void {
parent::setUp();
$taxonomy_public = $this->tainacan_entity_factory->create_entity(

View File

@ -17,7 +17,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
public $items_ids = [];
function setUp() {
function setUp(): void {
parent::setUp();
$collection = $this->tainacan_entity_factory->create_entity(
'collection',
@ -263,7 +263,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
@ -310,7 +310,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
//$bulk->add_value($this->multiple_meta, 'super');
@ -383,7 +383,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
'tax_query' => [
@ -431,7 +431,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$query = [
'meta_query' => [
@ -456,7 +456,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
@ -500,7 +500,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
@ -570,7 +570,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
@ -632,7 +632,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
]);
$this->assertEquals(0, $items->found_posts);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
'meta_query' => [
@ -676,7 +676,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $this->category->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$process = $this->new_process(
[
@ -690,7 +690,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $this->category->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
// should add super only to the 20 items that had test
$items = $Tainacan_Items->fetch([
@ -741,7 +741,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $this->metadatum->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
// should add super only to the 20 items that had even
@ -794,7 +794,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
]
);
// all items selected, search and replace the value of one
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
'meta_query' => [
@ -839,7 +839,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $this->category->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
'tax_query' => [
@ -910,7 +910,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $this->metadatum->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
'meta_query' => [
@ -967,7 +967,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => null,
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
@ -1002,7 +1002,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $this->multiple_meta->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$process = $this->new_process(
[
@ -1015,7 +1015,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $this->multiple_meta->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$ids = array_slice($this->items_ids, 2, 7);
@ -1032,7 +1032,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $this->multiple_meta->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
@ -1095,7 +1095,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $core_title->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$process = $this->new_process(
[
@ -1108,7 +1108,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $core_description->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
'meta_query' => [
@ -1171,7 +1171,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => null,
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
@ -1219,7 +1219,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => null,
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$trashed = $Tainacan_Items->fetch_ids(['post_status' => 'trash', 'posts_per_page' => -1]);
$rest = $Tainacan_Items->fetch_ids(['posts_per_page' => -1]);
@ -1238,7 +1238,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => null,
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$trashed = $Tainacan_Items->fetch_ids(['post_status' => 'trash', 'posts_per_page' => -1]);
$private = $Tainacan_Items->fetch_ids(['post_status' => 'private', 'posts_per_page' => -1]);
@ -1272,7 +1272,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => null,
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch_ids(['posts_per_page' => -1]);
$this->assertEquals(40, sizeof($items), 'Items must be on trash to be deleted');
@ -1288,7 +1288,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => null,
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$process = $this->new_process(
@ -1302,7 +1302,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => null,
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$trashed = $Tainacan_Items->fetch_ids(['post_status' => 'trash', 'posts_per_page' => -1]);
@ -1341,7 +1341,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $this->category->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
@ -1369,7 +1369,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $this->category->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
@ -1430,7 +1430,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $category2->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
@ -1458,7 +1458,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $category2->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
@ -1550,7 +1550,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $this->category->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
@ -1634,7 +1634,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $this->metadatum->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
// single valued metadatum dont accept array
$items = $Tainacan_Items->fetch([
@ -1672,7 +1672,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => $this->multiple_meta->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
@ -1730,7 +1730,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => null,
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$query = [
@ -1756,7 +1756,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id" => null,
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$items = $Tainacan_Items->fetch([
'comment_status' => 'closed',
@ -1822,7 +1822,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id_from" => $this->metadatum->get_id(),
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$query = [
'meta_query' => [
@ -1847,7 +1847,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id_from" => 'created_by',
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$query = [
'meta_query' => [
[
@ -1897,7 +1897,7 @@ class BulkEditBgProcess extends TAINACAN_UnitApiTestCase {
"metadatum_id_from" => $this->category->get_id()
]
);
$this->assertInternalType('int', $this->run_process($process));
$this->assertIsInt($this->run_process($process));
$query = [

View File

@ -13,9 +13,10 @@ use Tainacan\Entities\Collection;
/**
* @group permissions
*/
#[\AllowDynamicProperties]
class Capabilities extends TAINACAN_UnitTestCase {
function setUp() {
function setUp(): void {
parent::setUp();
/**
@ -857,7 +858,7 @@ class Capabilities extends TAINACAN_UnitTestCase {
}
/**
* @group collectionss
* @group collections
*/
function test_manage_collection_can_edit_collection() {
global $current_user;

View File

@ -127,7 +127,7 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
$this->assertFalse($metadatum2->validate(), 'Taxonomy Metadatum should not validate when using a taxonomy in use by another metadatum in the same collection');
$errors = $metadatum2->get_errors();
$this->assertInternalType('array', $errors);
$this->assertIsArray($errors);
$this->assertArrayHasKey('taxonomy_id', $errors[0]['metadata_type_options']);
}
@ -193,7 +193,7 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
$checkTax = $Tainacan_Taxonomies->fetch($tax->get_id());
$this->assertContains($collection->get_id(), $checkTax->get_collections_ids(), 'Collection must be added to taxonomy when metadatum is created');
$this->assertContains((string)$collection->get_id(), $checkTax->get_collections_ids(), 'Collection must be added to taxonomy when metadatum is created');
$metadatum->set_metadata_type_options([
@ -206,14 +206,14 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
$checkTax = $Tainacan_Taxonomies->fetch($tax->get_id());
$checkTax2 = $Tainacan_Taxonomies->fetch($tax2->get_id());
$this->assertContains($collection->get_id(), $checkTax2->get_collections_ids(), 'Collection must be added to taxonomy when metadatum is updated');
$this->assertNotContains($collection->get_id(), $checkTax->get_collections_ids(), 'Collection must be removed from taxonomy when metadatum is updated');
$this->assertContains((string)$collection->get_id(), $checkTax2->get_collections_ids(), 'Collection must be added to taxonomy when metadatum is updated');
$this->assertNotContains((string)$collection->get_id(), $checkTax->get_collections_ids(), 'Collection must be removed from taxonomy when metadatum is updated');
$metadatum = $Tainacan_Metadata->trash($metadatum);
$checkTax2 = $Tainacan_Taxonomies->fetch($tax2->get_id());
$this->assertNotContains($collection->get_id(), $checkTax2->get_collections_ids(), 'Collection must be removed from taxonomy when metadatum is deleted');
$this->assertNotContains((string)$collection->get_id(), $checkTax2->get_collections_ids(), 'Collection must be removed from taxonomy when metadatum is deleted');
$metadatum_repo = $this->tainacan_entity_factory->create_entity(
@ -590,10 +590,10 @@ class TaxonomyMetadatumTypes extends TAINACAN_UnitTestCase {
$meta = $Tainacan_ItemMetadata->insert($meta);
$this->assertInternalType( 'string', $meta->get_value_as_html() );
$this->assertInternalType( 'string', $meta->get_value_as_string() );
$this->assertIsString( $meta->get_value_as_html() );
$this->assertIsString( $meta->get_value_as_string() );
$this->assertInternalType( 'integer', strpos($meta->get_value_as_html(), '<a ') );
$this->assertIsInt( strpos($meta->get_value_as_html(), '<a ') );
$this->assertFalse( strpos($meta->get_value_as_string(), '<a ') );

View File

@ -14,7 +14,7 @@ namespace Tainacan\Tests;
class TestEntities extends TAINACAN_UnitTestCase {
function setUp() {
function setUp(): void {
parent::setUp();
$this->collection = $this->tainacan_entity_factory->create_entity(
'collection',

View File

@ -79,7 +79,7 @@ class Facets extends TAINACAN_UnitApiTestCase {
*
*/
function setUp() {
function setUp() : void{
parent::setUp();
$collection1 = $this->tainacan_entity_factory->create_entity(
'collection',

View File

@ -35,7 +35,7 @@ class TAINACAN_HTML_Injection extends TAINACAN_UnitTestCase
private $taxonomy = null;
private $taxonomy_db = null;
public function setUp()
public function setUp(): void
{
parent::setUp();
$link = $this->link;

View File

@ -282,7 +282,7 @@ class ImporterTests extends TAINACAN_UnitTestCase {
having
multiple
lines', 'Data 24', 'Data 25'),
array(get_current_user_id(), 'Data 31', 'Data 32', utf8_decode( 'Data 33||Rééço' ), 'Data 34', 'Data 35'),
array(get_current_user_id(), 'Data 31', 'Data 32', mb_convert_encoding('Data 33||Rééço', 'UTF-8', 'ISO-8859-1'), 'Data 34', 'Data 35'),
array(get_current_user_id(), 'Data 41', 'Data 42', 'Data 43||limbbo', 'Data 44', 'Data 45'),
array(get_current_user_id(), 'Data 51', 'Data 52', 'Data 53', 'Data 54', 'Data 55>>DATA551')
);
@ -447,7 +447,7 @@ class ImporterTests extends TAINACAN_UnitTestCase {
array(
'Data 31',
'458',
utf8_decode( 'Data 33||Rééço' ),
mb_convert_encoding( 'Data 33||Rééço', 'ISO-8859-1', 'UTF-8' ),
'https://www.codeproject.com/KB/GDI-plus/ImageProcessing2/img.jpg||https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/58f72418-b5ee-4765-8e80-e463623a921d/01-httparchive-opt-small.png',
'file:https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg'),
array('Data 41', '459', 'Data 43||limbbo', 'photos/SamplePNGImage_100kbmb.png||audios/SampleAudio_0.4mb.mp3', 'url:http://www.pdf995.com/samples/pdf.pdf'),

View File

@ -19,7 +19,7 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
private $item = null;
private $separator = '<span class="multivalue-separator"> | </span>';
public function setUp() {
public function setUp(): void {
parent::setUp();
$c = $this->tainacan_entity_factory->create_entity('collection', ['name' => 'My Collection'], true);
$i = $this->tainacan_entity_factory->create_entity(
@ -652,7 +652,7 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
$relationship_metadata->set_multiple('yes');
$item_metadata_relationship->set_value([ $mystify->get_id(), $disappear->get_id() ]);
$this->assertEquals($item_metadata_relationship->get_value_as_html(), "${expected_return}" . $this->separator . "${expected_return2}");
$this->assertEquals($item_metadata_relationship->get_value_as_html(), "$expected_return" . $this->separator . "$expected_return2");
}
function test_taxonomy_metadata_html() {
@ -760,7 +760,7 @@ class Item_Metadata extends TAINACAN_UnitTestCase {
private function relationship_expected_return($id, $title) {
$URL = get_permalink($id);
return "<a data-linkto='item' data-id='${id}' href='${URL}'>${title}</a>";
return "<a data-linkto='item' data-id='$id' href='$URL'>$title</a>";
}
function test_multiple_with_cardinality() {

View File

@ -19,7 +19,7 @@ class RelationshipMetadatumTypes extends TAINACAN_UnitTestCase {
private $collection_book = null;
private $collection_article = null;
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->collection_book = $this->tainacan_entity_factory->create_entity('collection', ['name' => 'Book', 'status' => 'publish'], true);
$this->collection_author = $this->tainacan_entity_factory->create_entity('collection', ['name' => 'Author', 'status' => 'publish'], true);