Skip to content

Commit

Permalink
Fix bugs of skip annotation and attribute
Browse files Browse the repository at this point in the history
See #6615
  • Loading branch information
Naktibalda committed Dec 18, 2022
1 parent 8da5932 commit 7f62fe1
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/Codeception/Test/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,14 @@ public function setParamsFromAnnotations($annotations): void
$params = Annotation::fetchAllAnnotationsFromDocblock((string)$annotations);
$this->params = array_merge_recursive($this->params, $params);

// set singular value for some params
$this->setSingularValueForSomeParams();
}

private function setSingularValueForSomeParams(): void
{
foreach (['skip', 'incomplete'] as $single) {
if (empty($this->params[$single])) {
$this->params[$single] = null;
} else {
$this->params[$single] = (string)($this->params[$single][0] ?? $this->params[$single][1]);
if (is_array($this->params[$single])) {
$this->params[$single] = $this->params[$single][0] ?? $this->params[$single][1] ?? '';
}
}
}
Expand Down Expand Up @@ -235,13 +237,12 @@ public function setParamsFromAttributes($attributes): void
$this->params[$single] = array_merge(...$this->params[$single]);
}


// set singular value for some params
foreach (['skip', 'incomplete'] as $single) {
$this->params[$single] = empty($this->params[$single]) ? null : (string)$this->params[$single][0];
}
$this->setSingularValueForSomeParams();
}

/**
* @deprecated
*/
public function setParams(array $params): void
{
$this->params = array_merge_recursive($this->params, $params);
Expand Down

0 comments on commit 7f62fe1

Please sign in to comment.