@requires is an annotation used by PHPUnit to flag a test as requiring a
PHP function or extension. c214c9a95 changed it to list two functions
separated by a slash:
@requires function apc_store/apcu_store
However that is not recognized by PHPUnit and the test is always
skipped.
Change the @requires to require the APCU extension.
Repro case:
phpunit.php --verbose includes/libs/MemoizedCallableTest.php
Follow-up c214c9a952
Bug: T140587
Change-Id: I1fdd52c8fc8ca1c7c0c7f914e6da8774799ba5d8
The default will remain PHPUnit 4.x due to PHP 5.5 support.
But, we should allow developers to run tests with newer PHPUnit
versions which are noticably faster (especially for code coverage
reports).
* <https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-5.4.0>
PHPUnit 5 deprecates the getMock() shortcut for getMockBuilder()->getMock().
It instead introduces the shortcut createMock() which has better defaults
than getMockBuilder(). For example, it sets 'disableArgumentCloning' and
other things by default.
Going forward, code should either use getMockBuilder directly and configure
it using the setter methods (instead of the confusing variadic arguments
of getMock) or simply use the new minimalistic createMock method. This patch
backports the createMock method to MediaWikiTestCase so that we can start
using it.
Change-Id: I091c0289b21d2b1c876adba89529dc3e72b99af2
Follows-up da3443bfa2.
It won't work across different requests due to use of uniqid()
internally (so we may want to use a HashBagOStuff for closure
instead to save memory in APC). But at least assert that it does
and is intended to work.
Change-Id: Id4b42e8717f62f733eee8fcc9a4ab6c0f5c1f2fe
Add a simple class to `libs/` for memoizing functions by caching return values
in APC. I decided not to make this an external library just yet because I see
this as potentially a part of a larger functional programming library.
Doesn't use APCBagOStuff for two reasons: (1) avoid dependency on MediaWiki
code; (2) ability to pass third &$success parameter to apc_store, to
distinguish between cache misses and cached false values.
Use this in ResourceLoaderFileModule to cache CSSMin::remap.
Change-Id: I00a47983a2583655d4631ecc9c6ba17597e36b5f