When trying to run some unit tests against some functions in Drupal, I get the following exception: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container.
As far as I know, the issue should revolve around not instantiating the modules properly. I think I'm doing it right, but I keep getting this error here and there throughout the project I'm working on. When asserting the function's return to another value, like this: , I get the error mentioned above. Shouldn't I expect another kind of error? Thanks in advance.
When I try to assert two parameters, I get the exception shown above, even though I'm mocking the modules I need and instantiating them properly (use Drupal\yadda yadda\yadda yadda...). Shouldn't I expect another kind of error?
$this->assertEquals('foo', $this->$someName->someMethod('something'));
Aucun commentaire:
Enregistrer un commentaire