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

yesct’s picture

Title: remove incorrect use Drupal\views\Plugin\Core\Entity\View statement from ViewEditTest » fix testDeleteLink() in ViewEditTest with use correct use (not Drupal\views\Plugin\Core\Entity\View) and assertTrue before assertFalse
Category: Task » Bug report
Issue summary: View changes
Priority: Minor » Normal

updating with what is really wrong (the test not testing what it thinks it is)

internetdevels’s picture

Status: Active » Needs review
StatusFileSize
new529 bytes

it's an accident that this does not fail.

View 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.

grimreaper’s picture

Hello,

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 ?

Status: Needs review » Needs work

The last submitted patch, 3: drupal-views_ui-fixed-using-view-class-2179903-3.patch, failed testing.

grimreaper’s picture

Status: Needs work » Needs review
StatusFileSize
new1.59 KB
spicy.werewolf’s picture

ViewEditTest.php moved to core/modules/views_ui/src/Tests/ViewEditTest.php

I rerolled the patch.

alimac’s picture

Issue summary: View changes
alimac’s picture

Status: Needs review » Reviewed & tested by the community

Patch applies and looks good to me (the change in file size of this patch appears to be cause by the number of context lines).

olli’s picture

#6 looks good and that new assertion fails without the fix in use statement, great!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 595e3b6 and pushed to 8.0.x. Thanks!

  • alexpott committed 595e3b6 on 8.0.x
    Issue #2179903 by Grimreaper, jahaimon, InternetDevels | YesCT: Fixed...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.