Changeset 5677
- Timestamp:
- 04/15/2015 04:31:15 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/includes/factory.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/factory.php
r5673 r5677 4 4 5 5 public $forum = null; 6 public $topic = null; 7 public $reply = null; 6 8 7 9 public function __construct() { … … 9 11 10 12 $this->forum = new BBP_UnitTest_Factory_For_Forum( $this ); 13 $this->topic = new BBP_UnitTest_Factory_For_Topic( $this ); 14 $this->reply = new BBP_UnitTest_Factory_For_Reply( $this ); 11 15 } 12 16 } … … 36 40 } 37 41 } 42 43 class BBP_UnitTest_Factory_For_Topic extends WP_UnitTest_Factory_For_Thing { 44 45 public function __construct( $factory = null ) { 46 parent::__construct( $factory ); 47 48 $this->default_generation_definitions = array( 49 'post_title' => new WP_UnitTest_Generator_Sequence( 'Topic %s' ), 50 'post_content' => new WP_UnitTest_Generator_Sequence( 'Content of Topic %s' ), 51 ); 52 } 53 54 public function create_object( $args ) { 55 return bbp_insert_topic( $args ); 56 } 57 58 public function update_object( $topic_id, $fields ) { 59 $fields['topic_id'] = $topic_id; 60 return bbp_update_topic( $fields ); 61 } 62 63 public function get_object_by_id( $topic_id ) { 64 return bbp_get_topic( $topic_id ); 65 } 66 } 67 68 class BBP_UnitTest_Factory_For_Reply extends WP_UnitTest_Factory_For_Thing { 69 70 public function __construct( $factory = null ) { 71 parent::__construct( $factory ); 72 73 $this->default_generation_definitions = array( 74 'post_content' => new WP_UnitTest_Generator_Sequence( 'Content of Reply %s' ), 75 ); 76 } 77 78 public function create_object( $args ) { 79 return bbp_insert_reply( $args ); 80 } 81 82 public function update_object( $reply_id, $fields ) { 83 $fields['reply_id'] = $reply_id; 84 return bbp_update_reply( $fields ); 85 } 86 87 public function get_object_by_id( $reply_id ) { 88 return bbp_get_reply( $reply_id ); 89 } 90 }
Note: See TracChangeset
for help on using the changeset viewer.