2016-01-27 04:26:15 +01:00
|
|
|
<?php
|
|
|
|
|
2016-03-05 20:47:41 +01:00
|
|
|
/**
|
|
|
|
* A factory for making WordPress data with a cross-object type API.
|
|
|
|
*
|
|
|
|
* Tests should use this factory to generate test fixtures.
|
|
|
|
*/
|
2016-01-27 04:26:15 +01:00
|
|
|
class WP_UnitTest_Factory {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var WP_UnitTest_Factory_For_Post
|
|
|
|
*/
|
|
|
|
public $post;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var WP_UnitTest_Factory_For_Attachment
|
|
|
|
*/
|
|
|
|
public $attachment;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var WP_UnitTest_Factory_For_Comment
|
|
|
|
*/
|
|
|
|
public $comment;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var WP_UnitTest_Factory_For_User
|
|
|
|
*/
|
|
|
|
public $user;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var WP_UnitTest_Factory_For_Term
|
|
|
|
*/
|
|
|
|
public $term;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var WP_UnitTest_Factory_For_Term
|
|
|
|
*/
|
|
|
|
public $category;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var WP_UnitTest_Factory_For_Term
|
|
|
|
*/
|
|
|
|
public $tag;
|
|
|
|
|
2016-05-25 20:20:24 +02:00
|
|
|
/**
|
|
|
|
* @since 4.6.0
|
|
|
|
* @var WP_UnitTest_Factory_For_Bookmark
|
|
|
|
*/
|
|
|
|
public $bookmark;
|
|
|
|
|
2016-01-27 04:26:15 +01:00
|
|
|
/**
|
|
|
|
* @var WP_UnitTest_Factory_For_Blog
|
|
|
|
*/
|
|
|
|
public $blog;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var WP_UnitTest_Factory_For_Network
|
|
|
|
*/
|
|
|
|
public $network;
|
|
|
|
|
|
|
|
function __construct() {
|
2017-12-01 00:09:33 +01:00
|
|
|
$this->post = new WP_UnitTest_Factory_For_Post( $this );
|
2016-01-27 04:26:15 +01:00
|
|
|
$this->attachment = new WP_UnitTest_Factory_For_Attachment( $this );
|
2017-12-01 00:09:33 +01:00
|
|
|
$this->comment = new WP_UnitTest_Factory_For_Comment( $this );
|
|
|
|
$this->user = new WP_UnitTest_Factory_For_User( $this );
|
|
|
|
$this->term = new WP_UnitTest_Factory_For_Term( $this );
|
|
|
|
$this->category = new WP_UnitTest_Factory_For_Term( $this, 'category' );
|
|
|
|
$this->tag = new WP_UnitTest_Factory_For_Term( $this, 'post_tag' );
|
|
|
|
$this->bookmark = new WP_UnitTest_Factory_For_Bookmark( $this );
|
2016-01-27 04:26:15 +01:00
|
|
|
if ( is_multisite() ) {
|
2017-12-01 00:09:33 +01:00
|
|
|
$this->blog = new WP_UnitTest_Factory_For_Blog( $this );
|
2016-01-27 04:26:15 +01:00
|
|
|
$this->network = new WP_UnitTest_Factory_For_Network( $this );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|