I love the feature to define custom services in behat tests and then use them across Context(s). However I experienced the problem when they are not accessible from static methods. This make it unable to access any custom service from behat hooks like
/**
* Creates the test entities before the test suite starts.
*
* @BeforeFeature @sometest
*/
public static function createTestEntities(): void {
// Custom behat service is obviously not presented in drupal's container
// and there is no way to access the plugin's one.
$service_not_recognized = \Drupal::service('my_test.behat.service');
}
Would it be possible to implement the way to obtain plugin's container to get the custom services from static methods as well? Or by some other way? That would be really really amazing. I searched for a way if I be able to get the container from static methods, but had no luck so far.
I love the feature to define custom services in behat tests and then use them across Context(s). However I experienced the problem when they are not accessible from static methods. This make it unable to access any custom service from behat hooks like
Would it be possible to implement the way to obtain plugin's container to get the custom services from static methods as well? Or by some other way? That would be really really amazing. I searched for a way if I be able to get the container from static methods, but had no luck so far.