- Issue created by @lauriii
- Status changed to Needs review
over 1 year ago 8:53pm 17 August 2023 - last update
over 1 year ago 30,040 pass, 2 fail The last submitted patch, 2: 3381770-2.patch, failed testing. View results →
- Status changed to Needs work
over 1 year ago 6:38am 18 August 2023 - 🇫🇮Finland lauriii Finland
Looks like
\Drupal\Core\Menu\MenuLinkManager::deleteInstance
checks if the menu link is deletable and is triggered by\Drupal\views\Plugin\views\display\PathPluginBase::remove
on view deletion.I can think of two potential approaches:
- Return link to the Views UI edit page from
\Drupal\views\Plugin\Menu\ViewsMenuLink::getDeleteRoute
. This might be confusing and I'm not sure what we should do when Views UI is not enabled. - Return
\Drupal\Core\Url
object that the user never has access to, essentially preventing rendering the delete link in the operations. I couldn't find utilities for this so not sure if there's a clean way to do this without introducing this.
- Return link to the Views UI edit page from
- Status changed to Needs review
over 1 year ago 6:46am 18 August 2023 - last update
over 1 year ago 30,036 pass, 1 fail - 🇫🇮Finland lauriii Finland
Here's a third option; check that a route is defined before creating the link in
\Drupal\Core\Menu\MenuLinkBase::getOperations
. The last submitted patch, 5: 3381770-5.patch, failed testing. View results →
- First commit to issue fork.
- Status changed to Needs work
about 1 year ago 12:16pm 13 December 2023 - 🇳🇱Netherlands Lendude Amsterdam
Option 3 sounds/looks good. Tried to reproduce the test fail locally, biut this test fails locally on HEAD too since it has a weird use of $base_path that doesn't work when running the test on '/'
When for convience I remove the base_path usage, the test is green. So lets see what happens on Gitlab first - 🇳🇱Netherlands Lendude Amsterdam
Hmm ok no idea why it failed on Drupal CI, but green now ¯\_(ツ)_/¯
Just needs some test coverage than I guess.
- Status changed to Needs review
about 1 year ago 2:18pm 13 December 2023 - 🇳🇱Netherlands Lendude Amsterdam
Added a test, chose a Unit test in this case since we are messing with a base class. Setting this up for a functional test would maybe involve depending on Views since that is probably the only place this happens, which we don't want for a test for the menu system
- Status changed to RTBC
about 1 year ago 2:34pm 14 December 2023 - 🇺🇸United States smustgrave
Updated IS to include my best take at what the proposed solution is
Ran the test-only feature
There were 2 failures: 1) Drupal\Tests\Core\Menu\MenuLinkBaseTest::testGetOperations with data set "is_resettable" (true) Failed asserting that an array does not have the key 'reset'. /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:121 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55 /builds/issue/drupal-3381770/core/tests/Drupal/Tests/Core/Menu/MenuLinkBaseTest.php:35 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/Framework/TestResult.php:728 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/Framework/TestSuite.php:684 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/Framework/TestSuite.php:684 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:651 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/TextUI/Command.php:144 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/TextUI/Command.php:97 2) Drupal\Tests\Core\Menu\MenuLinkBaseTest::testGetOperations with data set "is_not_resettable" (false) Failed asserting that an array does not have the key 'delete'. /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:121 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55 /builds/issue/drupal-3381770/core/tests/Drupal/Tests/Core/Menu/MenuLinkBaseTest.php:34 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/Framework/TestResult.php:728 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/Framework/TestSuite.php:684 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/Framework/TestSuite.php:684 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:651 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/TextUI/Command.php:144 /builds/issue/drupal-3381770/vendor/phpunit/phpunit/src/TextUI/Command.php:97 FAILURES! Tests: 2, Assertions: 5, Failures: 2.
Was able to also verify the screenshot on an umami install. Checking that the route exists before rendering the link seemed to work.
- 🇳🇿New Zealand quietone
I'm triaging RTBC issues → . I read the IS and the comments. I didn't find any unanswered questions or other work to do. And I see that there is agreement on the fix.
I also tested this today and the change works as expected.
Leaving at RTBC.
- Status changed to Needs work
12 months ago 12:50pm 12 January 2024 - 🇬🇧United Kingdom longwave UK
Unit tests now need strict_types enabled.
FILE: ...e-commits/core/tests/Drupal/Tests/Core/Menu/MenuLinkBaseTest.php ---------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ---------------------------------------------------------------------- 1 | ERROR | [x] Missing declare(strict_types=1). ---------------------------------------------------------------------- FILE: ...re/tests/Drupal/Tests/Core/Menu/MenuLinkNoOperationLinksMock.php ---------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ---------------------------------------------------------------------- 1 | ERROR | [x] Missing declare(strict_types=1). ----------------------------------------------------------------------