Skip to content

Commit

Permalink
Merge pull request #23916 from totten/master-wfmsg-data-boot
Browse files Browse the repository at this point in the history
WorkflowMessageTest - Fix weird inconsistency in resolving `@dataProvider`
  • Loading branch information
eileenmcnaughton authored Jun 30, 2022
2 parents a207283 + ebf5dbf commit b7d2f24
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions tests/phpunit/api/v4/Entity/WorkflowMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,28 @@ public function testRenderExamplesBaseline() {
}

public function getRenderExamples(): array {
$metas = \Civi\Test::examples()->getMetas();
// Phpunit resolves data-providers at a moment where bootstrap is awkward.
// Dynamic data-providers should call-out to subprocess which can do full/normal boot.
$uf = getenv('CIVICRM_UF');
try {
putenv('CIVICRM_UF=');
$metas = cv('api4 ExampleData.get +s name,workflow \'{"where":[["tags","CONTAINS","phpunit"]]}\'');
}
finally {
putenv("CIVICRM_UF={$uf}");
}

$results = [];
foreach ($metas as $name => $meta) {
if (!empty($meta['data']['workflow'])) {
continue;
}
if (empty($meta['tags']) || !in_array('phpunit', $meta['tags'])) {
foreach ($metas as $meta) {
if (!empty($meta['workflow'])) {
continue;
}
if ($exampleFilter = getenv('WORKFLOW_EXAMPLES')) {
if (!preg_match($exampleFilter, $name)) {
if (!preg_match($exampleFilter, $meta['name'])) {
continue;
}
}
$results[$name] = [$meta['name']];
$results[$meta['name']] = [$meta['name']];
}
return $results;
}
Expand Down

0 comments on commit b7d2f24

Please sign in to comment.