Tests: Run network option tests as single and multisite

The `_network_option()` functions are available to all and
internally use `_option()` functions as a fallback. We should
be testing for that scenario as well.

Fixes #36552.


git-svn-id: https://develop.svn.wordpress.org/trunk@37222 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt 2016-04-16 19:21:49 +00:00
parent e4b26366e4
commit 83d80f7329
1 changed files with 16 additions and 5 deletions

View File

@ -1,9 +1,10 @@
<?php
if ( is_multisite() ) :
/**
* Tests specific to network options in Multisite.
* Tests specific to managing network options in multisite.
*
* Some tests will run in single site as the `_network_option()` functions
* are available and internally use `_option()` functions as fallbacks.
*
* @group option
* @group ms-option
@ -11,6 +12,10 @@ if ( is_multisite() ) :
*/
class Tests_Option_NetworkOption extends WP_UnitTestCase {
function test_add_network_option_not_available_on_other_network() {
if ( ! is_multisite() ) {
$this->markTestSkipped( 'Test requires multisite' );
}
$id = self::factory()->network->create();
$option = rand_str();
$value = rand_str();
@ -20,6 +25,10 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
}
function test_add_network_option_available_on_same_network() {
if ( ! is_multisite() ) {
$this->markTestSkipped( 'Test requires multisite' );
}
$id = self::factory()->network->create();
$option = rand_str();
$value = rand_str();
@ -29,6 +38,10 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
}
function test_delete_network_option_on_only_one_network() {
if ( ! is_multisite() ) {
$this->markTestSkipped( 'Test requires multisite' );
}
$id = self::factory()->network->create();
$option = rand_str();
$value = rand_str();
@ -83,5 +96,3 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
);
}
}
endif;