← Back to team overview

mahara-contributors team mailing list archive

[Bug 1888335] [NEW] behat html report logic breaks when behat-html-formatter is reinstalled

 

Public bug reported:

On master branch
When running behat tests locally, there is an warning message like

[WAR] f9 (/home/ceciliavg/maharacode/mahara/external/vendor/emuse/behat-
html-formatter/src/Renderer/Behat2Renderer.php:94) count(): Parameter
must be an array or an object that implements Countable

To replicate:

- delete the external/vendor/emuse/behat-html-formatter
- run "make initcomposer" to reinstall the package
- run behat for a single feature file, e.g.
  ./test/behat/mahara_behat.sh run institution_smartevidence.feature

Expected result: the test passes with no warnings or errors
Actual results: the test passes but we can see many warnings like the one above.

This is happening because we replace the file Behat2Renderer.php with our version of it, where we add extra checks before calling count().
We used to add this every time we run behat, but we later change that to copy the file only when creating the html reports.

But we are actually using that Behat2Renderer file even when we are running behat without creating the html report. We would need to check if we can stop running this part of the code when we are not creating html reports, as it's not actually needed.
Also we can report the problem to the maintainers of the behat-html-formatter and submit the fixed Behat2Renderer.php

A quick fix for now:
to stop getting this warning messages, add the html option when running behat, like:
./test/behat/mahara_behat.sh run institution_smartevidence.feature html

this will copy the correct file into the package in vendor folder. This
needs to be done only once.

** Affects: mahara
     Importance: Low
         Status: Confirmed

** Affects: mahara/20.04
     Importance: Low
         Status: Confirmed

** Affects: mahara/20.10
     Importance: Low
         Status: Confirmed

** Changed in: mahara
   Importance: Undecided => Low

** Changed in: mahara
       Status: New => Confirmed

** Also affects: mahara/20.10
   Importance: Low
       Status: Confirmed

** Also affects: mahara/20.04
   Importance: Undecided
       Status: New

** Changed in: mahara/20.04
   Importance: Undecided => Low

** Changed in: mahara/20.04
       Status: New => Confirmed

** Description changed:

  On master branch
- When running behat tests locally, there is an warning message like 
+ When running behat tests locally, there is an warning message like
  
  [WAR] f9 (/home/ceciliavg/maharacode/mahara/external/vendor/emuse/behat-
  html-formatter/src/Renderer/Behat2Renderer.php:94) count(): Parameter
  must be an array or an object that implements Countable
  
  To replicate:
  
  - delete the external/vendor/emuse/behat-html-formatter
  - run "make initcomposer" to reinstall the package
  - run behat for a single feature file, e.g.
-   ./test/behat/mahara_behat.sh run institution_smartevidence.feature
+   ./test/behat/mahara_behat.sh run institution_smartevidence.feature
  
  Expected result: the test passes with no warnings or errors
  Actual results: the test passes but we can see many warnings like the one above.
  
  This is happening because we replace the file Behat2Renderer.php with our version of it, where we add extra checks before calling count().
  We used to add this every time we run behat, but we later change that to copy the file only when creating the html reports.
  
  But we are actually using that Behat2Renderer file even when we are running behat without creating the html report. We would need to check if we can stop running this part of the code when we are not creating html reports, as it's not actually needed.
  Also we can report the problem to the maintainers of the behat-html-formatter and submit the fixed Behat2Renderer.php
  
- 
  A quick fix for now:
  to stop getting this warning messages, add the html option when running behat, like:
  ./test/behat/mahara_behat.sh run institution_smartevidence.feature html
  
- this will copy the correct file into the package in vendor folder.
+ this will copy the correct file into the package in vendor folder. This
+ needs to be done only once.

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1888335

Title:
  behat html report logic breaks when behat-html-formatter is
  reinstalled

Status in Mahara:
  Confirmed
Status in Mahara 20.04 series:
  Confirmed
Status in Mahara 20.10 series:
  Confirmed

Bug description:
  On master branch
  When running behat tests locally, there is an warning message like

  [WAR] f9 (/home/ceciliavg/maharacode/mahara/external/vendor/emuse
  /behat-html-formatter/src/Renderer/Behat2Renderer.php:94) count():
  Parameter must be an array or an object that implements Countable

  To replicate:

  - delete the external/vendor/emuse/behat-html-formatter
  - run "make initcomposer" to reinstall the package
  - run behat for a single feature file, e.g.
    ./test/behat/mahara_behat.sh run institution_smartevidence.feature

  Expected result: the test passes with no warnings or errors
  Actual results: the test passes but we can see many warnings like the one above.

  This is happening because we replace the file Behat2Renderer.php with our version of it, where we add extra checks before calling count().
  We used to add this every time we run behat, but we later change that to copy the file only when creating the html reports.

  But we are actually using that Behat2Renderer file even when we are running behat without creating the html report. We would need to check if we can stop running this part of the code when we are not creating html reports, as it's not actually needed.
  Also we can report the problem to the maintainers of the behat-html-formatter and submit the fixed Behat2Renderer.php

  A quick fix for now:
  to stop getting this warning messages, add the html option when running behat, like:
  ./test/behat/mahara_behat.sh run institution_smartevidence.feature html

  this will copy the correct file into the package in vendor folder.
  This needs to be done only once.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1888335/+subscriptions


Follow ups