Open do-web opened 3 years ago
Hi @do-web,
Thank you for your issue. As you don't tell anything about how you run your functional test, I fear it is quite difficult to help here. But the testing-framework doesn't know anything about your .env file by default.
ok, but why does it try to establish a database connection?
class FunctionalTest extends FunctionalTestCase
{
/**
* @var array
*/
protected $testExtensionsToLoad = [
'typo3conf/ext/my_ext',
];
protected function setUp()
{
parent::setUp();
}
public function testCheck()
{
$this->assertFalse(false);
}
}
Hi @do-web,
Because database connection is needed to be set up for functional testing.
How can i load the real db instance from typo3 in the test?
This isn't possible due to functional testing is designed in TYPO3. The functional tests are always executed in an own instance with an own database being set up. You need to provide the data your tests expect to find in the database by using ->importDataSet() within your setUp method.
And if is use the normal UnitTestCase?
Maybe you want to share what you want to test so I can help you? Not sure what you need to do so it's hard to tell which approach to choose.
I have create a empty test case with typo3 9.x with composer and ddev and iam getting an error:
Maybe the .env is not loaded here with the database config?