From c86075377865372a536299c923bb04bfb4d0d7c9 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Sun, 10 May 2020 05:21:48 +0000 Subject: [PATCH] Tests: Add unit tests for `_cleanup_header_comment()`. Props pbearne. Fixes #38101. See #8497. git-svn-id: https://develop.svn.wordpress.org/trunk@47779 602fd350-edb4-49c9-b593-d223f7449a82 --- .../functions/_cleanup_header_comment.php | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 tests/phpunit/tests/functions/_cleanup_header_comment.php diff --git a/tests/phpunit/tests/functions/_cleanup_header_comment.php b/tests/phpunit/tests/functions/_cleanup_header_comment.php new file mode 100644 index 0000000000..0f1ceed3b0 --- /dev/null +++ b/tests/phpunit/tests/functions/_cleanup_header_comment.php @@ -0,0 +1,121 @@ +assertEquals( $expected, _cleanup_header_comment( $test_string ) ); + } + + /** + * Data provider for test_cleanup_header_comment. + * + * @return array[] Test parameters { + * @type string $test_string Test string. + * @type string $expected Expected return value. + * } + */ + public function data_cleanup_header_comment() { + return array( + // Set 0: A string. + array( + 'ffffffffffffff', + 'ffffffffffffff', + ), + // Set 1: Trim a string. + array( + ' ffffffffffffff ', + 'ffffffffffffff', + ), + // Set 2: Trim a full comment string. + array( + ' +dddlddfs +', + '