From 18d9640a5a6bb73169b6feeed07a68e89b53f708 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Tue, 19 Jan 2016 23:57:46 +0000 Subject: [PATCH] Themes: Add initial tests for the `allowed_themes` filter. We'll be adjusting the placement of this filter and adding two other related filters, so we should make sure it continues to work as expected after the change. See #28436. git-svn-id: https://develop.svn.wordpress.org/trunk@36350 602fd350-edb4-49c9-b593-d223f7449a82 --- .../phpunit/tests/theme/getAllowedFilters.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/phpunit/tests/theme/getAllowedFilters.php diff --git a/tests/phpunit/tests/theme/getAllowedFilters.php b/tests/phpunit/tests/theme/getAllowedFilters.php new file mode 100644 index 0000000000..11a498ae40 --- /dev/null +++ b/tests/phpunit/tests/theme/getAllowedFilters.php @@ -0,0 +1,35 @@ +default_allowed = WP_Theme::get_allowed( $blog_id ); + + add_filter( 'allowed_themes', array( $this, 'filter_allowed_themes' ), 10 ); + $allowed = WP_Theme::get_allowed( $blog_id ); + remove_filter( 'allowed_themes', array( $this, 'filter_allowed_themes' ), 10 ); + + $expected = $this->default_allowed + array( 'allow-on-network' => true ); + + $this->assertEquals( $expected, $allowed ); + } + + public function filter_allowed_themes( $allowed_themes ) { + $allowed_themes['allow-on-network'] = true; + + return $allowed_themes; + } +} \ No newline at end of file