Error running tests

Silverstripe Version: 4.3

Question: How can I fix this error when running tests on the CLI?

I’ve written some tests for my module but when I try to run them using;

vendor/bin/phphunit path/to/tests

I get the following error;

Fatal error: Uncaught Error: Maximum function nesting level of '256' reached, aborting! in /var/www/html/vendor/silverstripe/framework/src/Core/Config/ConfigLoader.php on line 48

Looking at the stack trace I see the following method calls repeated many many times;

   72.2130   26508672  14. SilverStripe\ORM\Connect\TempDatabase->resetDBSchema() /var/www/html/vendor/silverstripe/framework/src/ORM/Connect/TempDatabase.php:192
   72.8446   26555552  15. SilverStripe\ORM\Connect\TempDatabase->build() /var/www/html/vendor/silverstripe/framework/src/ORM/Connect/TempDatabase.php:288

My test file looks like this;

use SilverStripe\Security\Member;
use SilverStripe\Dev\FunctionalTest;
class LoginControllerTest extends FunctionalTest {
    protected static $fixture_file = 'members.yml';
     * Test login controller
    public function testLoginCorrectCredentials() {
        $member1 = $this->objFromFixture('Member', 'test1');
        $result = $this->postToLogin('{"email":"test@test.test", "pwd":"password"}');
        $this->assertEquals(200, $result->getStatusCode());
    function postToLogin($body = ""){
        return $this->post('user/login', null, null, null, $body);

and my fixture file is like this;

      FirstName: Test
      Email: test@test.test
      Password: password
      MemberType: customer
      FirstName: Test
      Email: retailer@test.test
      Password: password
      MemberType: Retailer         
      Date: 2018-12-13
      Price: 27.50
      Date: 2018-12-14
      Price: 500.57
      MemberID: 2

Sorry, I didn’t debug your example but from the error message it appears there might be some configuration issues.
Did you try to run
vendor/bin/sake dev/build flush=all
and see if it works?

Do the framework built-in tests pass?