I've managed to write some simple PHPUnit tests, but because the classes within my module have some methods that try to load entities (Content Types built via standard Drupal UI) and then do various thing with them, I am having trouble how to bridge this gap.
Currently when I run my tests most of the assertions pass as they are fairly simply but the one is giving me a warning:
The data provider specified for Drupal\Tests\lrgContentTypes\Unit\AuctionEventTest::testGetNodeFields is invalid. \Drupal::$container is not initialised yet. \Drupal::setContainer() must be called with a real container.
This has only occurred recently because I have now fleshed out the code for the entity class that the parent is trying to pass in the provider.
I am unsure where to go from here, the Drupal 8 documentation seems to be spotty and gives no clear guidance from a basics point of view.
Are there examples that show how to test methods that try to load a node via Node::load()
and where entity reference revision objects are expected?