BehatHtmlFormatterPlugin icon indicating copy to clipboard operation
BehatHtmlFormatterPlugin copied to clipboard

AfterSuiteTested vs AfterSuiteAborted

Open aronbeal opened this issue 8 years ago • 3 comments

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?

aronbeal avatar Mar 11 '16 23:03 aronbeal

I've forked this repo until the above can be fixed

pharman avatar Mar 31 '16 10:03 pharman

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.

kenorb avatar Aug 31 '17 10:08 kenorb

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

r4cker avatar May 20 '23 10:05 r4cker