Problem: The module has to be enabled for the whole test suite in order to use it for couple of Scenarios. When using the subcontext the DatetimeTestingContext is included and the DatetimeTestingContext::resetTime() is being executed after every scenario due to the tag @AfterScenario. If the module is not enabled, we get an error:

AfterScenario # DatetimeTestingContext::resetTime()
Fatal error: Call to undefined method Drupal\Component\Datetime\Time::resetTime() (Behat\Testwork\Call\Exception\FatalThrowableError)

Motivation: In our project we would like to have the freedom to enable the module on demand and being able to disable when it is not required.

Solution: I have provided a patch that checks if the module is enabled when the method is executed in @AfterScenario.

CommentFileSizeAuthor
#2 datetime_testing-3114849-2.patch830 bytesjoevagyok

Comments

joevagyok created an issue. See original summary.

joevagyok’s picture

StatusFileSize
new830 bytes

  • ademarco committed 831b5f7 on 8.x-1.x authored by joevagyok
    Issue #3114849 by joevagyok: Testing: Call to undefined method resetTime...
ademarco’s picture

Status: Active » Reviewed & tested by the community
ademarco’s picture

Status: Reviewed & tested by the community » Fixed
ademarco’s picture

Status: Fixed » Closed (fixed)