-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Factor out DatastoreResource class #4372
base: 2.x
Are you sure you want to change the base?
Conversation
Currently debugging failing MySqlQueryDownloadControllerTest, which I think just happens to be the first test to run that tries to run a query. It fails at |
Some progress. Need to redo QueryDownloadControllerTest somehow... not so easy to use fake resource names because table name is no longer based on an ID in the DatastoreResource class that we can simply control via the constructor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drupal\Tests\datastore\Unit\Storage\DatabaseTableFactoryTest
still creates a DatastoreResource
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add to the docblock of Drupal\datastore\Storage\DatabaseTableFactory::getInstance()
that the resource must be a DataResource object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drupal\Tests\datastore\Unit\Plugin\QueueWorker\ImportJobTest
spends a lot of time making DatastoreResource
objects.
Drupal\Tests\datastore\Unit\Service\Info\ImportInfoTest
too.
Basically search the codebase for DatastoreResource
and you'll see a bunch of tests.
Fixes #4359
Describe your changes
Remove DatastoreResource class, use DataResource for everything. Note that any class or function that expected a DatastoreResource object now expects a DataResource object. So any custom code that, for instance, builds a datastore
DatabaseTable
object will need to be slightly refactored.Other changes to note:
AbstractDatabaseTable::setTable()
is now public. We should use this directly instead of calling::count()
(as we do currently in some places) to indirectly create a database table.DictionaryEnforcer
now requires thedkan.datastore.database_table_factory
servicePlease override the CC warnings when reviewing, they are due to CC getting confused by the ReturnTypeMayChange attribute. May be an issue with CC config.
QA Steps
Nothing to QA, everything should still work as it did before from user's perspective.
Checklist before requesting review
If any of these are left unchecked, please provide an explanation