- Issue created by @daffie
- Merge request !8220Always default the module name setting for database driver to their driver name → (Open) created by daffie
- Status changed to Needs review
3 months ago 7:48am 24 September 2024 - Merge request !9592Always default the module name setting for database driver to their driver name → (Open) created by daffie
- 🇺🇸United States smustgrave
Mind rebasing? 11.x branch is 400+ commits behind.
- 🇺🇸United States smustgrave
Thanks! Test-only feature was able to run now
1) Drupal\Tests\Core\Database\UrlConversionTest::testNoModuleIsSpecifiedExceptionIsRemoved
Failed asserting that exception of type "InvalidArgumentException" matches expected exception "Drupal\Core\Extension\Exception\UnknownExtensionException". Message was: "Can not convert 'mongodb://test_user:test_pass@test_host/test_database' to a database connection, the module providing the driver 'mongodb' is not specified" at
/builds/issue/drupal-3450706/core/lib/Drupal/Core/Database/Database.php:530
/builds/issue/drupal-3450706/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php:316
.
FAILURES!Applied a nitpicky change for a void return.
Changing to the driver name didn't seem to break mysql or the other tests so believe it's a fine update.
- 🇳🇱Netherlands daffie
@quietone: You are right, it is better to use another name for the database then "mongodb". I have changed it to "dummydb". I thought that I had an option to add "mongodb" to the Drupal core code. :)
- 🇺🇸United States smustgrave
smustgrave → changed the visibility of the branch 3450706-let-for-all to hidden.
- 🇺🇸United States smustgrave
Hiding MR 8220
Feedback for 9592 has been addressed.
- Status changed to Needs work
5 days ago 4:06pm 14 December 2024 - 🇬🇧United Kingdom alexpott 🇪🇺🌍
This seems like a good idea. Less special casing core FTW.
Added some comments to the MR to address.
- 🇳🇱Netherlands daffie
Addressed the remarks and suggestions of @alexpott.
Back to NR. - 🇬🇧United Kingdom alexpott 🇪🇺🌍
I think we should be fixing the PHPStan errors in the new class we're adding - I can't see why we'd add these errors to the baseline.
- 🇳🇱Netherlands daffie
Removed the added style guide violations from the base line file.
Back to NR. - 🇮🇹Italy mondrake 🇮🇹
Question: can't we use something from
Drupal\core_fake\Driver\Database\CoreFakeWithAllCustomClasses
instead of adding a completely new dummy db and all of its minimal implementations?Anyway, the above should not hold this. RTBC
- 🇳🇱Netherlands daffie
We cannot use
Drupal\core_fake\Driver\Database\CoreFakeWithAllCustomClasses
for testing with this MR, because of the fact that the module name and the driver name are not the same.
Back to RTBC. - 🇬🇧United Kingdom alexpott 🇪🇺🌍
How about adding a driver_test driver to core/modules/system/tests/modules/driver_test can be a copy of system/tests/modules/driver_test/src/Driver/Database/DriverTestMysql with the driver name changed to driver_test... less to maintain but the same amount of code coverage.
- 🇳🇱Netherlands daffie
How about adding a driver_test driver to core/modules/system/tests/modules/driver_test can be a copy of system/tests/modules/driver_test/src/Driver/Database/DriverTestMysql with the driver name changed to driver_test... less to maintain but the same amount of code coverage.
That sounds like a good idea, only it does not work. For that to work the $url need to change to:
'driver_test://test_user:test_pass@test_host/test_database'
. That url gets parsed into components and the result will be:array ( "path" => "driver_test://test_user:test_pass@test_host/test_database" );
No schema and host values are set and a \InvalidArgumentException wiil be thrown with the message: "The database connection URL 'driver_test://test_user:test_pass@test_host/test_database' is invalid. The minimum requirement is: 'driver://host/database'" The function
parse_url
does not accept schema's with an underscore character in it. To me, we have 2 options: the first is to change the module name "driver_test" to "drivertest". That will result in a lot of code changes. The other is to leave it like it is and go with the new test module called "dummydb". Putting the issue back to RTBC for the core committers decision. - 🇬🇧United Kingdom alexpott 🇪🇺🌍
Okay let's keep on with dummydb but instead of extending the abstract connection class lets extend another db driver so we don't have to think about / maintain so much stuff we're not using here.
- 🇳🇱Netherlands daffie
The dummydb database driver is now dependent on the one for MySQL.
Back to NR. - 🇮🇹Italy mondrake 🇮🇹
Looks great to me, thanks for hearing my question. I triggered Sqlite and PgSql pipelines for safety, even though I do not think they are relevant here. RTBC
-
alexpott →
committed 8fd18feb on 11.x
Issue #3450706 by daffie, smustgrave, alexpott, quietone, mondrake: Let...
-
alexpott →
committed 8fd18feb on 11.x