Updated: Comment #1
Problem/Motivation
the "use Drupal\views\Plugin\Core\Entity\View;" statement in Drupal\views_ui\Tests\ViewEditTest is wrong - does not exist.
at the very end of function testDeleteLink() it wants to know what a View is:
$this->assertFalse($view instanceof View);
it's an accident that this does not fail.
assert false without a corresponding assertion of truth is odd.
likely, earlier in the test, before it deletes the view, something like this:
$view = $this->container->get('entity.manager')->getStorageController('view')->load('test_view');
$this->assertTrue($view instanceof View);
would have picked up that the use statement was wrong.
Proposed resolution
Add the assertTrue and correct the use so that it works.
Remaining tasks
User interface changes
No
API changes
No
Original report by @alexpott
via irc
Comments
Comment #1
yesct commentedupdating with what is really wrong (the test not testing what it thinks it is)
Comment #2
internetdevels commentedView is deleted in this test. So what should be in the $view variable after view deleting? I don't see reasons why this is wrong and hope we can just pass second argument to the assertFalse() for clarification. Please correct me if I'm wrong.
Patch for incorrect use statement attached.
Comment #3
grimreaperHello,
With git blame, I get those informations :
commit 742908a681c08e221f04aebdd480c3e7194da38b
Commit message : Issue #2057427 by dawehner, olli: Fixed No delete operation available while editing a view.
I Added the assertTrue statement.
Is it ok now ?
Comment #5
grimreaperComment #6
spicy.werewolf commentedViewEditTest.php moved to core/modules/views_ui/src/Tests/ViewEditTest.php
I rerolled the patch.
Comment #7
alimac commentedComment #8
alimac commentedPatch applies and looks good to me (the change in file size of this patch appears to be cause by the number of context lines).
Comment #9
olli commented#6 looks good and that new assertion fails without the fix in use statement, great!
Comment #10
alexpottCommitted 595e3b6 and pushed to 8.0.x. Thanks!