From fde455a89f9eaaae9513ca722f2de20420ca4bdd Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Tue, 27 Feb 2018 14:37:15 +0000 Subject: [PATCH] External Libraries: Test that MediaElement SWF files remain deleted. The files were removed from Core in r42462 because they're no longer necessary, and have a history of security issues. They remain upstream, though, so this test makes it explicitly clear that they should not be added back in the future without careful consideration and discussion with the Security team. `Tests_Admin_IncludesUpdateCore::test_new_files_are_not_in_old_files_array_compiled()` would already catch files with the exact same name, but this test will also catch files with new names, just to be extra cautious. Props iandunn, ocean90, SergeyBiryukov Fixes 43101 git-svn-id: https://develop.svn.wordpress.org/trunk@42762 602fd350-edb4-49c9-b593-d223f7449a82 --- .../tests/dependencies/mediaelementjs.php | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/phpunit/tests/dependencies/mediaelementjs.php diff --git a/tests/phpunit/tests/dependencies/mediaelementjs.php b/tests/phpunit/tests/dependencies/mediaelementjs.php new file mode 100644 index 0000000000..36359710df --- /dev/null +++ b/tests/phpunit/tests/dependencies/mediaelementjs.php @@ -0,0 +1,36 @@ +assertGreaterThan( 0, count( $js_files ) ); + + $mejs_directory_iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $mejs_folder ) ); + $mejs_swf_iterator = new RegexIterator( $mejs_directory_iterator, '/\.swf$/i', RecursiveRegexIterator::GET_MATCH ); + + // Make sure the Flash files haven't been re-added accidentally. + $this->assertCount( 0, iterator_to_array( $mejs_swf_iterator ) ); + } +}