Changeset 5673
- Timestamp:
- 04/07/2015 12:35:06 PM (10 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/bootstrap.php
r5610 r5673 22 22 */ 23 23 function _load_loader() { 24 25 // Check if we're running the BuddyPress test suite 26 if ( defined( 'BBP_TESTS_BUDDYPRESS' ) ) { 27 28 // If BuddyPress is found, set it up and require it. 29 if ( defined( 'BP_TESTS_DIR' ) ) { 30 require BP_TESTS_DIR . '/includes/loader.php'; 31 } 32 } 33 24 34 require( BBP_TESTS_DIR . '/includes/loader.php' ); 25 35 } … … 31 41 echo "Loading bbPress testcase...\n"; 32 42 require( BBP_TESTS_DIR . '/includes/testcase.php' ); 43 require( BBP_TESTS_DIR . '/includes/factory.php' ); 44 45 if ( defined( 'BBP_TESTS_BUDDYPRESS' ) ) { 46 echo "Loading BuddyPress testcase...\n"; 47 require BP_TESTS_DIR . '/includes/testcase.php'; 48 } else { 49 echo "Not running BuddyPress tests. To execute these, use --group buddypress\n"; 50 } -
trunk/tests/phpunit/includes/define-constants.php
r5610 r5673 53 53 die( "wp-tests-config.php could not be found.\n" ); 54 54 } 55 56 // Determine whether BuddyPress is present. 57 if ( ! defined( 'BP_TESTS_DIR' ) ) { 58 $wp_content_dir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); 59 if ( file_exists( $wp_content_dir . '/buddypress/tests/phpunit/bootstrap.php' ) ) { 60 define( 'BP_TESTS_DIR', $wp_content_dir . '/buddypress/tests/phpunit' ); 61 } 62 } -
trunk/tests/phpunit/includes/factory.php
r5610 r5673 2 2 3 3 class BBP_UnitTest_Factory extends WP_UnitTest_Factory { 4 function __construct() { 4 5 public $forum = null; 6 7 public function __construct() { 5 8 parent::__construct(); 9 10 $this->forum = new BBP_UnitTest_Factory_For_Forum( $this ); 6 11 } 7 12 } 13 14 class BBP_UnitTest_Factory_For_Forum extends WP_UnitTest_Factory_For_Thing { 15 16 public function __construct( $factory = null ) { 17 parent::__construct( $factory ); 18 19 $this->default_generation_definitions = array( 20 'post_title' => new WP_UnitTest_Generator_Sequence( 'Forum %s' ), 21 'post_content' => new WP_UnitTest_Generator_Sequence( 'Content of Forum %s' ), 22 ); 23 } 24 25 public function create_object( $args ) { 26 return bbp_insert_forum( $args ); 27 } 28 29 public function update_object( $forum_id, $fields ) { 30 $fields['forum_id'] = $forum_id; 31 return bbp_update_forum( $fields ); 32 } 33 34 public function get_object_by_id( $forum_id ) { 35 return bbp_get_forum( $forum_id ); 36 } 37 } -
trunk/tests/phpunit/includes/loader.php
r5610 r5673 6 6 echo "Determining installation type...\n"; 7 7 system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( WP_TESTS_CONFIG_PATH ) . ' ' . escapeshellarg( WP_TESTS_DIR ) . ' ' . $multisite ); 8 9 require dirname( __FILE__ ) . '/../../../src/bbpress.php'; -
trunk/tests/phpunit/includes/testcase.php
r5671 r5673 30 30 31 31 $this->factory = new BBP_UnitTest_Factory; 32 33 if ( class_exists( 'BP_UnitTest_Factory' ) ) { 34 $this->bp_factory = new BP_UnitTest_Factory(); 35 } 32 36 } 33 37
Note: See TracChangeset
for help on using the changeset viewer.