Changeset 13304 for trunk/tests/phpunit/testcases/core/functions.php
- Timestamp:
- 07/26/2022 01:31:07 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/functions.php
r12680 r13304 6 6 7 7 class BP_Tests_Core_Functions extends BP_UnitTestCase { 8 protected $bp_initial_version; 9 8 10 /** 9 11 * @group bp_esc_sql_order … … 876 878 return array_merge( $page_default_titles, array( 'newcomponent' => 'NewComponent' ) ); 877 879 } 880 881 public function override_initial_version() { 882 return $this->bp_initial_version; 883 } 884 885 /** 886 * @ticket BP8687 887 */ 888 public function test_bp_get_deprecated_functions_versions() { 889 $current_version = (float) bp_get_version(); 890 $versions = bp_get_deprecated_functions_versions(); 891 892 // When current version is the initial version, we shouldn't load deprecated functions files. 893 $this->assertTrue( is_array( $versions ) && ! $versions, 'Please check the list of `$deprecated_functions_versions` in `bp_get_deprecated_functions_versions()`. There should be one for each file of the `/src/bp-core/deprecated` directory.' ); 894 895 // We should load the 2 lasts deprecated functions files. 896 $this->bp_initial_version = '8.0'; 897 898 add_filter( 'pre_option__bp_initial_major_version', array( $this, 'override_initial_version' ), 10, 0 ); 899 900 $versions = bp_get_deprecated_functions_versions(); 901 902 remove_filter( 'pre_option__bp_initial_major_version', array( $this, 'override_initial_version' ), 10, 0 ); 903 904 $this->assertTrue( 2 === count( $versions ) ); 905 906 // Even if this version does not exist in deprecated functions files, we should load the 2 lasts. 907 $this->bp_initial_version = '1.0'; 908 909 add_filter( 'pre_option__bp_initial_major_version', array( $this, 'override_initial_version' ), 10, 0 ); 910 911 $versions = bp_get_deprecated_functions_versions(); 912 913 remove_filter( 'pre_option__bp_initial_major_version', array( $this, 'override_initial_version' ), 10, 0 ); 914 915 $this->assertTrue( 2 === count( $versions ) ); 916 } 878 917 }
Note: See TracChangeset
for help on using the changeset viewer.