0

I am new to testing custom modules. My custom modules create and update custom nodes. From my reading, I need to use Kernel or Functional tests to test these operations. My Drupal 9 installation is on Windows Server with IIS and Microsoft SQL Server.

All the testing examples seem to use mysql in their phpunit.xml config. I must use the sqlsrv driver module to have Drupal communicate with the MSSQL database. When I try and use sqlsrv in my phpunit.xml SIMPLETEST_DB connection key, I get a database connection error when running the test.

My phpunit.xml database line:

<env name="SIMPLETEST_DB" value="sqlsrv://username:password@localhost/database_name"/>

The error I get:

InvalidArgumentException : Can not convert 'sqlsrv://username:password@localhost/database_name to a database connection, class 'Drupal\Driver\Database\sqlsrv\Connection' does not exist

Is a MSSQL database server not compatible with the testing environment created for Drupal? Can I only use MySQL?

Followup question:

Something I didn't get from my reading, should a second database be used just for testing since it will be creating and deleting info? If that's the case, could I use a MySQL database just for testing?

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.