Updated: Comment #N

Problem/Motivation

When running phpunit with test coverage, you get the following two errors:

1) Drupal\menu_link\Tests\MenuTreeTest::testOutputWithSingleLevel
PHP_CodeCoverage_Exception: Trying to @cover not existing method "\Drupal\menu_link\MenuTree::output".


2) Drupal\menu_link\Tests\MenuTreeTest::testOutputWithComplexData
PHP_CodeCoverage_Exception: Trying to @cover not existing method "\Drupal\menu_link\MenuTree::output".

Read http://phpunit.de/manual/3.7/en/appendixes.annotations.html#appendixes.a... for more information about @covers

Proposed resolution

::output should be ::output()

Remaining tasks

User interface changes

API changes

Original report by @Berdir

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Assigned: dawehner » amitaibu
Issue summary: View changes
Issue tags: +Novice

::

dawehner’s picture

Assigned: amitaibu » Unassigned

ups.

dawehner’s picture

Issue summary: View changes
saltednut’s picture

Assigned: Unassigned » saltednut
saltednut’s picture

Assigned: saltednut » Unassigned
Status: Active » Needs review
FileSize
840 bytes

I don't see any errors running PHPunit from the UI. I also don't see anything about including () in the docs at http://phpunit.de/manual/3.7/en/code-coverage-analysis.html

That said, here's a patch that does what the issue summary asks for.

saltednut’s picture

Perhaps this should actually be: @covers ::renderTree ?

Berdir’s picture

Status: Needs review » Needs work

(Written in Budapest, submitted in Zurich, so a bit crossposted with @brantwynn, yes renderTree I think)

The UI/simpletest integration is broken anyway, but to see the errors, you need to run the tests with xdebug enabled and --coverage-html ./reports or something like that.

Agreed, () isn't the problem here, the problem is that the method has been renamed, I think it's renderTree now?

That means you should change @covers to that and also rename the test methods, because refer the same non-existing "output" thing.

saltednut’s picture

Status: Needs work » Needs review
FileSize
844 bytes

Okay, lets try this.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

ooh, embarrassing moment nr2

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

  • Commit 204ecf1 on 8.x by webchick:
    Issue #2229123 by brantwynn, Berdir: Wrong @covers definition in...

Status: Fixed » Closed (fixed)

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