@@ -44,18 +44,49 @@ function xwp_filter_active_plugins_for_phpunit( $active_plugins ) {
4444 function () {
4545 // Manually load the plugin.
4646 require dirname ( __DIR__ ) . '/stream.php ' ;
47+
48+ // Install database.
49+ $ plugin = wp_stream_get_instance ();
50+ $ plugin ->install ->check ();
4751 }
4852);
53+
4954function xwp_manually_load_mercator () {
5055 define ( 'MERCATOR_SKIP_CHECKS ' , true );
5156 require WPMU_PLUGIN_DIR . '/mercator/mercator.php ' ;
5257}
5358
5459tests_add_filter ( 'muplugins_loaded ' , 'xwp_manually_load_mercator ' );
5560
61+ function xwp_install_edd () {
62+ // Install Easy Digital Downloads
63+ edd_install ();
64+
65+ global $ current_user , $ edd_options ;
66+
67+ $ edd_options = get_option ( 'edd_settings ' );
68+
69+ $ current_user = new WP_User (1 );
70+ $ current_user ->set_role ('administrator ' );
71+ wp_update_user ( array ( 'ID ' => 1 , 'first_name ' => 'Admin ' , 'last_name ' => 'User ' ) );
72+ add_filter ( 'edd_log_email_errors ' , '__return_false ' );
73+
74+ add_filter (
75+ 'pre_http_request ' ,
76+ function ( $ status = false , $ args = array (), $ url = '' ) {
77+ return new WP_Error ( 'no_reqs_in_unit_tests ' , __ ( 'HTTP Requests disabled for unit tests ' , 'easy-digital-downloads ' ) );
78+ }
79+ );
80+ }
81+
5682// @see https://core.trac.wordpress.org/browser/trunk/tests/phpunit/includes/bootstrap.php
5783require $ _tests_dir . '/includes/bootstrap.php ' ;
5884
85+ define ( 'EDD_USE_PHP_SESSIONS ' , false );
86+ define ( 'WP_USE_THEMES ' , false );
87+ activate_plugin ( 'easy-digital-downloads/easy-digital-downloads.php ' );
88+ xwp_install_edd ();
89+
5990require __DIR__ . '/testcase.php ' ;
6091
6192// Base class for future tests
0 commit comments