-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from woocommerce/24-02/activation-test-loopback
Add self-tests for Activation Tests loopback
- Loading branch information
Showing
4 changed files
with
423 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
return [ | ||
'php' => '7.4', | ||
'wp' => 'rc', | ||
'woo' => 'rc', | ||
]; |
22 changes: 22 additions & 0 deletions
22
_tests/activation/loopback/woocommerce-product-feeds/woocommerce-product-feeds.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/* | ||
* Plugin name: Activation - Plugin A | ||
*/ | ||
|
||
add_action( 'wp', static function () { | ||
trigger_error( 'Site URL: ' . get_site_url() ); | ||
$response = wp_remote_get( get_site_url() . '/wp-json/' ); | ||
|
||
if ( is_wp_error( $response ) ) { | ||
trigger_error( 'Loopback error: ' . $response->get_error_message() ); | ||
} else { | ||
$data = json_decode( wp_remote_retrieve_body( $response ), true ); | ||
|
||
if ( isset( $data['name'] ) ) { | ||
trigger_error( 'Site name from wp-json: ' . $data['name'] ); | ||
} else { | ||
trigger_error( 'Site name not found in wp-json response' ); | ||
} | ||
} | ||
} ); |
Oops, something went wrong.