- Issue created by @alt36
- First commit to issue fork.
- 🇬🇧United Kingdom jonathan1055
Thanks for raising this issue and giving the details. It is a problem and I'll work on the fix right now.
- last update
7 months ago 224 pass, 2 fail - last update
7 months ago 224 pass, 2 fail - last update
7 months ago 224 pass, 2 fail - last update
7 months ago 224 pass, 2 fail - last update
7 months ago 224 pass, 2 fail - last update
7 months ago 224 pass, 2 fail - 🇬🇧United Kingdom jonathan1055
Test fail on drupal.org simply because I am writing out debug. They pass on gitlab.
- last update
7 months ago 224 pass, 2 fail - last update
7 months ago 224 pass, 2 fail - Status changed to Needs review
7 months ago 8:56am 26 April 2024 - 🇬🇧United Kingdom jonathan1055
The module is loaded due to it being required by commerce_product, so testing the token module is going to take a bit more work. The commerce_product module is enabled at the start, and then test products are created, so uninstalling the module (a pre-requisite to uninstalling token) is difficult to do within the executing test.
I have tested the change to
_scheduler_token_types()
locally when the token module is not installed, and it works. If others can test and confirm this change, I may commit that fix and release Scheduler 2.0.3, then work on the test coverage later. - Status changed to RTBC
7 months ago 9:19am 26 April 2024 - 🇬🇧United Kingdom alt36
The MR works for me - specifically I've checked with commit bd16830, which I can see now checks if the token.entity_mapper service is available. Thanks!
- last update
7 months ago 230 pass - last update
7 months ago 230 pass - last update
7 months ago 230 pass - last update
7 months ago 230 pass - 🇬🇧United Kingdom jonathan1055
Thank you both for confirming the fix. I have also now added test coverage, checking that the url to add a node, media item or taxonomy term still works and give 200 when the token module is uninstalled. Without the fixed code (using the new "test-only changes" phpunit job, which incidentally I worked on adding into gitlab templates) we only get a failure for
media/add/{media_type}
, there is no failure fornode/add/{nodetype}
oradmin/structure/taxonomy/manage/{vocab}/add
. Same thing happens when I run the phpunit tests locally. Thehook_token_info()
is not called for nodes and taxonomy terms in the test environment, I guess it must be something to do with which input filters are active in the tests? or something else, any ideas?At least the test does fail for 'media' so we have proof that we are now covering that part of the functionality with the extra test.
- last update
7 months ago 230 pass -
jonathan1055 →
committed b3b4ab7e on 2.x
Issue #3443183 by jonathan1055, alt36, sense-design: Call to non-...
-
jonathan1055 →
committed b3b4ab7e on 2.x
- Status changed to Fixed
7 months ago 1:34pm 28 April 2024 - 🇬🇧United Kingdom jonathan1055
I have done some more investigation. The content type does not need to be enabled for Scheduling to get the original error. It is caused when
hook_tokens
is invoked, as shown in the backtraceDrupal::service('token.entity_mapper') (Line: 30) _scheduler_token_types() (Line: 71) scheduler_tokens('date', Array, Array, Array, Object) call_user_func_array(Object, Array) (Line: 409) Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'scheduler') (Line: 388) Drupal\Core\Extension\ModuleHandler->invokeAllWith('tokens', Object) (Line: 416) Drupal\Core\Extension\ModuleHandler->invokeAll('tokens', Array) (Line: 364) Drupal\Core\Utility\Token->generate('date', Array, Array, Array, Object) (Line: 241) Drupal\Core\Utility\Token->doReplace(1, '[date:custom:Y]-[date:custom:m]', Array, Array, Object) (Line: 191) Drupal\Core\Utility\Token->replace('[date:custom:Y]-[date:custom:m]', Array) (Line: 318) Drupal\file\Plugin\Field\FieldType\FileItem::doGetUploadLocation(Array, Array) (Line: 296) Drupal\file\Plugin\Field\FieldType\FileItem->getUploadLocation() (Line: 236) ...
This is done when the entity has a file upload field defined, because the upload directory location uses the year and month template, defined with [ ] for formatting the date. If the entity does not have a file upload field then there it no call to
->invokeAll('tokens')
and no error. That's why the phpunit tests for node and taxonomy term did not fail. Addind a node fails in my UI because it an image field attached. Taxonomy term does not fail in the UI because there is no file upload. -
jonathan1055 →
committed ba93361d on 2.x
Issue #3443183 by jonathan1055: Tidy up new token test and improve...
-
jonathan1055 →
committed ba93361d on 2.x
Automatically closed - issue fixed for 2 weeks with no activity.