(NFC) dev/core#2029 - Make assertions in PrevNextTest more skimmable
authorTim Otten <totten@civicrm.org>
Wed, 21 Oct 2020 05:41:37 +0000 (22:41 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 21 Oct 2020 05:47:36 +0000 (22:47 -0700)
commit3e9cd8a84a13f27d14224fbb957468de3d79fe93
tree966e4a60b4f1be814e576bfa8f1a70cb30feebbd
parenteba889b00e49f0b306b2215e507259254355f868
(NFC) dev/core#2029 - Make assertions in PrevNextTest more skimmable

Overview
--------

The test appears to have a random failure. Making it more readable may help figure out why.

Before
------

`testDeleteByCacheKey()` and the related `testFillArray()` both have some assertions in these two forms:

```
// Form #1, more verbose
$all = ...getSelections($cacheKey, $action);
$this->assertEquals([...expected...], array_keys($all)...);

// Form #2, more pithy
$this->assertSelections([...expected...], $action, $cacheKey);
```

After
-----

The verbose form is replaced with the pithier form.

In the pithier form, some of the default inputs are made explicit.

Comment
-------

It is confusing that the method `getSelections()` has a parameter `$action`
which can be `get` or `getall` -- and that `getall` does not (in fact) return
selections.  It returns all!  (The fact that the contract is weird makes the
unit-test helpful imho...)
tests/phpunit/E2E/Core/PrevNextTest.php