Build/Test Tools: Run the Ajax test group for multisite.

This will help catch issues with Ajax related functionality on multisite.

A few tests have also been marked as `skipWithMultisite()` as they require network admin level capabilities when performing the same operations on a multisite install.

Props garrett-eclipse, netweb.
Fixes #46567.

git-svn-id: https://develop.svn.wordpress.org/trunk@49835 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2020-12-18 14:38:28 +00:00
parent 8bc7e0c0e5
commit 3723941a9c
6 changed files with 13 additions and 0 deletions

View File

@ -257,6 +257,9 @@ jobs:
- name: Run tests as a multisite install
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml
- name: Run AJAX tests as a multisite install
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ajax
- name: Run ms-files tests as a multisite install
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files

View File

@ -673,6 +673,10 @@ module.exports = function(grunt) {
cmd: 'phpunit',
args: ['--verbose', '-c', 'tests/phpunit/multisite.xml']
},
'ms-ajax': {
cmd: 'phpunit',
args: ['--verbose', '-c', 'tests/phpunit/multisite.xml', '--group', 'ajax']
},
'ms-files': {
cmd: 'phpunit',
args: ['--verbose', '-c', 'tests/phpunit/multisite.xml', '--group', 'ms-files']

View File

@ -65,6 +65,8 @@ class Tests_Ajax_Attachments extends WP_Ajax_UnitTestCase {
* @ticket 36578
*/
public function test_wp_ajax_send_attachment_to_editor_should_return_a_link() {
$this->skipWithMultisite();
// Become an administrator.
$post = $_POST;
$user_id = self::factory()->user->create(

View File

@ -126,6 +126,7 @@ class Tests_Ajax_Delete_Plugin extends WP_Ajax_UnitTestCase {
}
public function test_delete_plugin() {
$this->skipWithMultisite();
$this->_setRole( 'administrator' );
$_POST['_ajax_nonce'] = wp_create_nonce( 'updates' );

View File

@ -102,6 +102,7 @@ class Tests_Ajax_Manage_Themes extends WP_Ajax_UnitTestCase {
}
public function test_update_theme() {
$this->skipWithMultisite();
$this->_setRole( 'administrator' );
$_POST['_ajax_nonce'] = wp_create_nonce( 'updates' );
@ -139,6 +140,7 @@ class Tests_Ajax_Manage_Themes extends WP_Ajax_UnitTestCase {
}
function test_uppercase_theme_slug() {
$this->skipWithMultisite();
$this->_setRole( 'administrator' );
$_POST['_ajax_nonce'] = wp_create_nonce( 'updates' );

View File

@ -130,6 +130,7 @@ class Tests_Ajax_Update_Plugin extends WP_Ajax_UnitTestCase {
}
public function test_update_plugin() {
$this->skipWithMultisite();
$this->_setRole( 'administrator' );
$_POST['_ajax_nonce'] = wp_create_nonce( 'updates' );