Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(REF) APIv4 ConformanceTest - Split apart into per-entity sub-tests #17845

Merged
merged 1 commit into from
Jul 15, 2020

Conversation

totten
Copy link
Member

@totten totten commented Jul 15, 2020

Overview

This updates a unit-test to make the output easier to understand.

We need more output because the test sporadically fails, and we don't know why.

ping @colemanw

Before

There is a function testConformance() which internally loops through a list of entities.

Whenever the test fails, it aborts testing and reports one failure (for all entities) without indicating the specific entity which failed.

After

There is a test function testConformance($entity) which uses a data provider.

Whenever the test fails, it will be logged with the entity name. Testing can resume for additional entities.

Technical Details

There are a couple technical distinctions between this revision, the previous revision, and the comparable APIv3 test:

  1. Each test-case returned by the '@dataProvider' has a symbolic name. These are easier to skim than numeric names.

  2. The list of entities is not based on runtime services, because that constrains how PHPUnit and Civi lifecycles interact. It uses a heuristic/low-tech listing (getEntitiesLotech()). In the rare case where the low-tech list is wrong, it will complain and ask for maintenance.

Overview
--------

This updates a unit-test to make the output easier to understand.

We need more output because the test sporadically fails, and we don't know why.

Before
------

There is a function `testConformance()` which internally
loops through a list of entities.

Whenever the test fails, it aborts testing and reports one failure (for all
entities) without indicating the specific entity which failed.

After
-----

There is a test function `testConformance($entity)` which uses
a data provider.

Whenever the test fails, it will be logged with the entity name.
Testing can resume for additional entities.

Technical Details
-----------------

There are a couple technical distinctions between this revision, the
previous revision, and the comparable APIv3 test:

1. Each test-case returned by the '@dataProvider' has a symbolic name.
   These are easier to skim than numeric names.

2. The list of entities is *not* based on runtime services,
   because that constrains how PHPUnit and Civi lifecycles interact.
   It uses a heuristic/low-tech listing (`getEntitiesLotech()`).
   In the rare case where the low-tech list is wrong, it will complain
   and ask for maintenance.
@civibot
Copy link

civibot bot commented Jul 15, 2020

(Standard links)

@civibot civibot bot added the master label Jul 15, 2020
@colemanw
Copy link
Member

Great!

@colemanw colemanw merged commit 3ce3f14 into civicrm:master Jul 15, 2020
@totten totten deleted the master-api4-conf-provider branch July 16, 2020 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants