wpIsIniValueChangeable.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Tests for wp_is_ini_value_changeable().
  4. *
  5. * @group load.php
  6. * @covers ::wp_is_ini_value_changeable
  7. */
  8. class Tests_Load_wpIsIniValueChangeable extends WP_UnitTestCase {
  9. /**
  10. * Tests the determining of the changeability of a PHP ini value.
  11. *
  12. * @ticket 32075
  13. *
  14. * @dataProvider data_wp_is_ini_value_changeable
  15. *
  16. * @param string $setting The setting passed to wp_is_ini_value_changeable().
  17. * @param bool $expected The expected output of wp_convert_hr_to_bytes().
  18. */
  19. function test_wp_is_ini_value_changeable( $setting, $expected ) {
  20. $this->assertSame( $expected, wp_is_ini_value_changeable( $setting ) );
  21. }
  22. /**
  23. * Data provider for test_wp_is_ini_value_changeable().
  24. *
  25. * @return array {
  26. * @type array {
  27. * @type string $setting The setting passed to wp_is_ini_value_changeable().
  28. * @type bool $expected The expected output of wp_convert_hr_to_bytes().
  29. * }
  30. * }
  31. */
  32. function data_wp_is_ini_value_changeable() {
  33. $array = array(
  34. array( 'memory_limit', true ), // PHP_INI_ALL.
  35. array( 'log_errors', true ), // PHP_INI_ALL.
  36. array( 'upload_max_filesize', false ), // PHP_INI_PERDIR.
  37. array( 'upload_tmp_dir', false ), // PHP_INI_SYSTEM.
  38. );
  39. if ( extension_loaded( 'Tidy' ) && version_compare( PHP_VERSION, '7.0.0', '>' ) ) {
  40. $array[] = array( 'tidy.clean_output', true ); // PHP_INI_USER.
  41. }
  42. return $array;
  43. }
  44. }