From: jeroendedauw Date: Sun, 12 Aug 2012 19:37:54 +0000 (+0200) Subject: Added utility method taking an array of elements and wrapping each element in it... X-Git-Tag: 1.31.0-rc.0~22746^2 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=10f8b5f3401b385d9270bbfed199ee356209ca98;p=lhc%2Fweb%2Fwiklou.git Added utility method taking an array of elements and wrapping each element in it's own array. Useful for data providers that only return a single argument. Change-Id: I220948865e3de395363bf8858098e61de3c8d35b --- diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index c96eba02f6..ea33c50833 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -387,6 +387,26 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { $this->assertFalse( $r, "found extra row (after #$i)" ); } + /** + * Utility method taking an array of elements and wrapping + * each element in it's own array. Useful for data providers + * that only return a single argument. + * + * @since 1.20 + * + * @param array $elements + * + * @return array + */ + protected function arrayWrap( array $elements ) { + return array_map( + function( $element ) { + return array( $element ); + }, + $elements + ); + } + /** * Assert that two arrays are equal. By default this means that both arrays need to hold * the same set of values. Using additional arguments, order and associated key can also