More explicit test fixtures: key and count

These fields get automatic values during normal operation, but we
should make this explicit in tests which meddle with internals.  This
seems to add some clarity, and helps prepare for encapsulation.

Bug: T353451
Change-Id: I8b012a270f16139671f77ea04645d627b2fba87d
This commit is contained in:
Adam Wight 2023-12-21 21:14:12 +01:00 committed by Awight
parent 76e6e870d4
commit ca6414320f
2 changed files with 10 additions and 3 deletions

View file

@ -945,16 +945,18 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase {
],
'Safely ignore placeholder' => [
'initialCallStack' => [
[ 'increment', 1, 'foo', null, null, null, [] ],
[ 'increment', 2, 'foo', null, null, null, [] ],
],
'initialRefs' => [ 'foo' => [
[
'count' => -1,
'key' => 1,
'placeholder' => true,
'number' => 10,
],
[
'count' => 2,
'key' => 1,
'key' => 2,
],
] ],
'rollbackCount' => 1,
@ -963,12 +965,14 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase {
],
'expectedRefs' => [ 'foo' => [
[
'count' => -1,
'key' => 1,
'placeholder' => true,
'number' => 10,
],
[
'count' => 1,
'key' => 1,
'key' => 2,
],
] ],
],

View file

@ -84,6 +84,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
'a' => [
'count' => 0,
'key' => 1,
'name' => 'a',
'number' => 9,
'text' => 't1',
],
@ -112,12 +113,14 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
'extends' => 'b',
'extendsIndex' => 1,
'key' => 2,
'name' => 'a',
'number' => 1,
'text' => 't2',
],
'b' => [
'count' => 0,
'key' => 3,
'name' => 'b',
'number' => 1,
'text' => 't3',
],