ec53bf5bf6
This changeset adds a unit test factory so that bookmark/link fixtures can be created during tests. Why are we writing tests for functionality that has been deprecated for years? Because it's the Right Thing to Do. See #18356. git-svn-id: https://develop.svn.wordpress.org/trunk@37563 602fd350-edb4-49c9-b593-d223f7449a82
76 lines
1.5 KiB
PHP
76 lines
1.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* A factory for making WordPress data with a cross-object type API.
|
|
*
|
|
* Tests should use this factory to generate test fixtures.
|
|
*/
|
|
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;
|
|
|
|
/**
|
|
* @since 4.6.0
|
|
* @var WP_UnitTest_Factory_For_Bookmark
|
|
*/
|
|
public $bookmark;
|
|
|
|
/**
|
|
* @var WP_UnitTest_Factory_For_Blog
|
|
*/
|
|
public $blog;
|
|
|
|
/**
|
|
* @var WP_UnitTest_Factory_For_Network
|
|
*/
|
|
public $network;
|
|
|
|
function __construct() {
|
|
$this->post = new WP_UnitTest_Factory_For_Post( $this );
|
|
$this->attachment = new WP_UnitTest_Factory_For_Attachment( $this );
|
|
$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 );
|
|
if ( is_multisite() ) {
|
|
$this->blog = new WP_UnitTest_Factory_For_Blog( $this );
|
|
$this->network = new WP_UnitTest_Factory_For_Network( $this );
|
|
}
|
|
}
|
|
}
|