diff --git a/tests/phpunit/tests/functions/isPhpVersionCompatible.php b/tests/phpunit/tests/functions/isPhpVersionCompatible.php new file mode 100644 index 0000000000..abbd03e08d --- /dev/null +++ b/tests/phpunit/tests/functions/isPhpVersionCompatible.php @@ -0,0 +1,53 @@ +assertSame( is_php_version_compatible( $test_value ), $expected ); + } + + /** + * Provides test scenarios for test_php_version_compatible. + * + * @return array + */ + function data_is_php_version_compatible() { + $php_version = phpversion(); + + $more = explode( '.', $php_version ); + $less = $more; + + -- $less[ count( $less ) - 1 ]; + ++ $more[ count( $less ) - 1 ]; + + return array( + 'greater' => array( + 'test_value' => implode( '.', $more ), + 'expected' => false, + ), + 'same' => array( + 'test_value' => $php_version, + 'expected' => true, + ), + 'less' => array( + 'test_value' => implode( '.', $less ), + 'expected' => true, + ), + ); + } +} diff --git a/tests/phpunit/tests/functions/isWpVersionCompatible.php b/tests/phpunit/tests/functions/isWpVersionCompatible.php new file mode 100644 index 0000000000..dfec2a37cb --- /dev/null +++ b/tests/phpunit/tests/functions/isWpVersionCompatible.php @@ -0,0 +1,53 @@ +assertSame( is_wp_version_compatible( $test_value ), $expected ); + } + + /** + * Provides test scenarios test_is_wp_version_compatible. + * + * @return array + */ + function data_is_wp_version_compatible() { + $wp_version = get_bloginfo( 'version' ); + + $more = explode( '.', $wp_version ); + $less = $more; + + -- $less[0]; + ++ $more[0]; + + return array( + 'greater' => array( + 'test_value' => implode( '.', $more ), + 'expected' => false, + ), + 'same' => array( + 'test_value' => $wp_version, + 'expected' => true, + ), + 'less' => array( + 'test_value' => implode( '.', $less ), + 'expected' => true, + ), + ); + } +}