BehatHtmlFormatterPlugin
BehatHtmlFormatterPlugin copied to clipboard
AfterSuiteTested vs AfterSuiteAborted
In throwing an exception within my Behat Step definition, I correctly fail a given behat test. However, before the command returns, I get the following:
Recoverable fatal error: Argument 1 passed to emuse\BehatHTMLFormatter\Formatter\BehatHTMLFormatter::onAfterSuiteTested() must be an instance of Behat\Testwork\EventDispatcher\Event\AfterSuiteTested, instance of Behat\Testwork\EventDispatcher\Event\AfterSuiteAborted given in emuse\BehatHTMLFormatter\Formatter\BehatHTMLFormatter->onAfterSuiteTested() (line 474 of [excluded]/vendor/emuse/behat-html-formatter/src/Formatter/BehatHTMLFormatter.php).
I was able to resolve this issue (and a subsequent one) by changing
public function onAfterSuiteTested(AfterSuiteTested $event)
and
public function onAfterExercise(AfterExerciseCompleted $event)
to
public function onAfterSuiteTested(\Behat\Testwork\EventDispatcher\Event\SuiteTested $event)
and
public function onAfterExercise(\Behat\Testwork\EventDispatcher\Event\ExerciseCompleted $event)
Is there a reason you're using the specific classes rather than the interfaces here?
I've forked this repo until the above can be fixed
Same error here after tests are run:
TypeError: Argument 1 passed to emuse\BehatHTMLFormatter\Formatter\BehatHTMLFormatter::onAfterSuiteTested() must be an instance of Behat\Testwork\EventDispatcher\Event\AfterSuiteTested, instance of Behat\Testwork\EventDispatcher\Event\AfterSuiteAborted given in emuse\BehatHTMLFormatter\Formatter\BehatHTMLFormatter->onAfterSuiteTested() (line 416 of vendor/emuse/behat-html-formatter/src/Formatter/BehatHTMLFormatter.php).
Affected file: BehatHTMLFormatter.php
.
I had the same issue because I used the folowing commande line
bin/behat --strict --stop-on-failure
I you remove --stop-on-failure it should works