Partially revert 74b4d669a7. Type checks were removed on the
basis that they are redundant with the PHP warnings raised by
array_key_exists(), but PHP 8.0 does not raise such warnings. The
PHP 8.0 migration doc says: "The behavior of array_key_exists()
regarding the type of the key parameter has been made consistent with
isset() and normal array access. All key types now use the usual
coercions and array/object keys throw a TypeError."
We could just remove the tests, but the original rationale does stand,
since without this change, we have
> $m = new MapCacheLRU(4);
> $m->set(3.4, 'x');
> print $m->get(3, 'x');
x
without any warning, which seems surprising.
Bug: T283275
Change-Id: I3628daef21611ff3f6bc252f105deed886ce8088
In commit 70c2223843, the explicit type checks were added as
exceptions because WMF's infra at the time didn't capture stacktraces
for the native warnings that PHP already emits.
That infra issue was resolved years ago (T45086), so we can remove
these again.
I've kept one manual type check, which is in setField, because for
$field in that method we don't first check existence (which emits
the warning normally), and because it does an assignment rather than
a key check, and assignments in PHP still have some invalid types
that don't emit warnings (specifically, booleans).
Bug: T275673
Change-Id: I72388f069afc345da9e9aac330733da49714d1b4
This changeset implements T89432 and related tickets and is based on exploration
done at the Prague Hackathon. The goal is to identify tests in MediaWiki core
that can be run without having to install & configure MediaWiki and its dependencies,
and provide a way to execute these tests via the standard phpunit entry point,
allowing for faster development and integration with existing tooling like IDEs.
The initial set of tests that met these criteria were identified using the work Amir did in
I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory
under phpunit/ and organized into a separate test suite. The environment for this suite
is set up via a PHPUnit bootstrap file without a custom entry point.
You can execute these tests by running:
$ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml
Bug: T89432
Bug: T87781
Bug: T84948
Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d
2019-06-13 22:56:31 +02:00
Renamed from tests/phpunit/includes/libs/MapCacheLRUTest.php (Browse further)