workshop-drupal-automated-testing
workshop-drupal-automated-testing copied to clipboard
Tests fail after step 16.12
The step states to change ArticleRepository to:
...
public function __invoke(): array {
- return [];
...
+ return [
+ '#markup' => render($build),
+ ];
}
This is incorrect as the return statement had been changed in step 15.5 to:
return [
'#markup' => $this->t('Welcome to my blog!'),
];
And a test had been built to expect this output.
Because of this, after step 16.12 the test suite fails with:
The text "Welcome to my blog!" was not found anywhere in the text of the current page.
Either the test needs to be changed to remove this assertion, or the return statement needs to include the removed text (which will mean the image would need to be updated as well):
return [
- '#markup' => $this->t('Welcome to my blog!'),
+ '#markup' => $this->t('Welcome to my blog!') . render($build),
];