Problem/Motivation

Part of the unfolding saga of #2052109: [meta] Expand phpunit tests for \Drupal\Component\Plugin classes

In this issue we cover StaticDiscoveryDecorator, which is the last of the Component\Plugin classes without unit tests (in HEAD or patched in issues).

Proposed resolution

Remaining tasks

User interface changes

API changes

Comments

mile23’s picture

Status: Active » Needs review
StatusFileSize
new8.48 KB

Patch covers all methods other than __construct().

mile23’s picture

StatusFileSize
new8.47 KB
new1.23 KB

Some formatting and coding standards changes.

duaelfr’s picture

89/89 tests PASS
Coverage:

  • Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator 66% (__construct and __call marked as not covered)

There are a few comments to make it better:

  1. +++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
    @@ -0,0 +1,232 @@
    +use Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator;
    +
    

    Unused.

  2. +++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php
    @@ -0,0 +1,232 @@
    +  public function getRegisteredDefintionCallback() {
    ...
    +      ->setMethods(array('registeredDefintionCallback'))
    ...
    +      ->method('registeredDefintionCallback');
    ...
    +      ->setMethods(array('registeredDefintionCallback'))
    ...
    +        array($this->getRegisteredDefintionCallback(), 'registeredDefintionCallback')
    ...
    +      ->setMethods(array('registeredDefintionCallback'))
    ...
    +        array($this->getRegisteredDefintionCallback(), 'registeredDefintionCallback')
    

    Typo in "registeredDefintionCallback" that might be spelled "registeredDefinitionCallback".

mile23’s picture

StatusFileSize
new8.57 KB
new2.75 KB

Thanks!

Got rid of the extra use.

Fixed the typo, and changed the name(s) to match the name of the property.

Also I discovered I hadn't finished the docblock for one of the data providers.

Try again...

duaelfr’s picture

Tests PASS

Coverage:

  • __construct 0%
  • getDefinition 100%
  • getDefinitions 100%
  • __call 0%

About the __call coverage I found a PhpUnit issue but I tried StaticDiscoveryDecorator::__call, Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator::__call and \Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator::__call without success.

As __call is a one line method and as the given test pass, we could consider it 100% covered.
It seems that __construct is not always tested and this class constructor is really simple so I don't think we must test it.

So, for me it's RTBC!

mile23’s picture

Want to set the status?

duaelfr’s picture

Status: Needs review » Reviewed & tested by the community

Forgot this one ;)
Thanks.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 4: 2379419_4.patch, failed testing.

daffie queued 4: 2379419_4.patch for re-testing.

daffie’s picture

Status: Needs work » Reviewed & tested by the community

Back to RTBC. The f**king testbot again!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Not really the most qualified to give these sign-off, but they've been sitting here long enough for someone to raise objections, and moar test coverage is never a bad thing.

Committed and pushed to 8.0.x. Thanks!

  • webchick committed 9df9e02 on 8.0.x
    Issue #2379419 by Mile23, DuaelFr: Expand unit testing for Drupal\...

Status: Fixed » Closed (fixed)

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