Commit graph

8 commits

Author SHA1 Message Date
Reedy
27ee63f8c9 Remove pre PHP 7.4 serialize()/unserialize()
Depends-On: I3b893152ed278a72b5e74ccf91a3381f319bfcd9
Change-Id: I9f69a9316eaec23103262ec2ffd5b85baaf16f3f
2022-11-10 19:25:01 +00:00
Tim Starling
d737242a6e MapCacheLRU: Restore key type checks
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
2022-01-21 15:22:32 +11:00
Timo Tijhof
74b4d669a7 MapCacheLRU: Remove redundant type checks in favour of native warnings
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
2021-08-18 00:10:10 +01:00
Timo Tijhof
880083a8b7 MapCacheLRU: Add tests for getWithSet
Bug: T275673
Change-Id: I473bd4becab6bdd16642bf41805bfd279af0a3c1
2021-08-18 00:10:10 +01:00
Timo Tijhof
3007dd624c objectcache: Add regression test for MapCacheLRU serialization
Follows-up fb5116028b (I77d42b43f4).

Bug: T218511
Change-Id: I157ef19899ac4e07ab456bc81e3c8c8d4989b9e6
2020-04-16 17:55:17 +01:00
Max Semenik
5bf93709f4 Move a lot of libs tests to the unit test directory
Change-Id: Ie7eb1016cd735f07b00524815598581e0d485f2a
2019-11-11 17:53:56 -08:00
Legoktm
4e35134f7a Revert "Separate MediaWiki unit and integration tests"
This reverts commit 0a2b996278.

Reason for revert: Broke postgres tests.

Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
2019-06-13 23:00:08 +00:00
Máté Szabó
0a2b996278 Separate MediaWiki unit and integration tests
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)