Commit 0bab86f9 authored by alexpott's avatar alexpott

Issue #2418237 by Mile23, neclimdul, jyotisankar: Fix incorrect @covers in PHPUnit tests.

parent 273e7fc4
......@@ -123,7 +123,7 @@ public function testCalculateDependencies() {
}
/**
* @covers ::id()
* @covers ::id
*/
public function testId() {
$config = new ContentLanguageSettings(array(
......@@ -134,7 +134,7 @@ public function testId() {
}
/**
* @covers ::getTargetEntityTypeId()
* @covers ::getTargetEntityTypeId
*/
public function testTargetEntityTypeId() {
$config = new ContentLanguageSettings(array(
......@@ -145,7 +145,7 @@ public function testTargetEntityTypeId() {
}
/**
* @covers ::getTargetBundle()
* @covers ::getTargetBundle
*/
public function testTargetBundle() {
$config = new ContentLanguageSettings(array(
......@@ -156,8 +156,8 @@ public function testTargetBundle() {
}
/**
* @covers ::getDefaultLangcode()
* @covers ::setDefaultLangcode()
* @covers ::getDefaultLangcode
* @covers ::setDefaultLangcode
*
* @dataProvider providerDefaultLangcode
*/
......@@ -185,8 +185,8 @@ public function providerDefaultLangcode() {
}
/**
* @covers ::setLanguageAlterable()
* @covers ::isLanguageAlterable()
* @covers ::setLanguageAlterable
* @covers ::isLanguageAlterable
*
* @dataProvider providerLanguageAlterable
*/
......@@ -220,7 +220,7 @@ public function providerLanguageAlterable() {
}
/**
* @covers ::isDefaultConfiguration()
* @covers ::isDefaultConfiguration
*
* @dataProvider providerIsDefaultConfiguration
*/
......@@ -254,7 +254,7 @@ public function providerIsDefaultConfiguration() {
}
/**
* @covers ::loadByEntityTypeBundle()
* @covers ::loadByEntityTypeBundle
*
* @dataProvider providerLoadByEntityTypeBundle
*/
......
......@@ -30,10 +30,8 @@ protected function getModuleAndPath() {
}
/**
* Tests BaseFieldDefinition::getColumns().
*
* @covers ::getColumns
* @covers ::schema
* @covers ::getSchema
*/
public function testGetColumns() {
$this->assertSame(array(), $this->definition->getColumns());
......
......@@ -14,7 +14,7 @@
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\system\Controller\SystemController::setLinkActiveClass()
* @coversDefaultClass \Drupal\system\Controller\SystemController
* @group system
*/
class SystemControllerTest extends UnitTestCase {
......@@ -345,6 +345,7 @@ public function providerTestSetLinkActiveClass() {
* The returned renderable array.
*
* @dataProvider providerTestSetLinkActiveClass
* @covers ::setLinkActiveClass
*/
public function testSetLinkActiveClass(array $element, array $context, $expected_element) {
$this->assertSame($expected_element, SystemController::setLinkActiveClass($element, $context));
......
......@@ -111,7 +111,7 @@ public function testConstruct() {
}
/**
* @covers ::defineOptions()
* @covers ::defineOptions
*/
public function testDefineOptionsWithNoOptions() {
$definition = [
......@@ -138,7 +138,7 @@ public function testDefineOptionsWithNoOptions() {
}
/**
* @covers ::defineOptions()
* @covers ::defineOptions
*/
public function testDefineOptionsWithDefaultFormatter() {
$definition = [
......@@ -165,7 +165,7 @@ public function testDefineOptionsWithDefaultFormatter() {
}
/**
* @covers ::calculateDependencies()
* @covers ::calculateDependencies
*/
public function testCalculateDependenciesWithBaseField() {
$definition = [
......@@ -187,7 +187,7 @@ public function testCalculateDependenciesWithBaseField() {
}
/**
* @covers ::calculateDependencies()
* @covers ::calculateDependencies
*/
public function testCalculateDependenciesWithConfiguredField() {
$definition = [
......@@ -213,7 +213,7 @@ public function testCalculateDependenciesWithConfiguredField() {
}
/**
* @covers ::access()
* @covers ::access
*/
public function testAccess() {
$definition = [
......
......@@ -11,7 +11,7 @@
use Drupal\views\Tests\TestHelperPlugin;
/**
* @coversDefaultClass \Drupal\views\Plugin\views\PluginBase.
* @coversDefaultClass \Drupal\views\Plugin\views\PluginBase
* @group views
*/
class PluginBaseTest extends UnitTestCase {
......@@ -46,9 +46,8 @@ protected function setUp() {
* @param bool $all
* Whether to unpack all options.
*
* @see \Drupal\views\Plugin\views\PluginBase::unpackOptions.
*
* @dataProvider providerTestUnpackOptions
* @covers ::unpackOptions
*/
public function testUnpackOptions($storage, $options, $definition, $expected, $all = FALSE) {
$this->testHelperPlugin->unpackOptions($storage, $options, $definition, $all);
......@@ -65,9 +64,8 @@ public function testUnpackOptions($storage, $options, $definition, $expected, $a
* @param array $expected
* The expected array after unpacking
*
* @see \Drupal\views\Plugin\views\PluginBase::setOptionDefaults.
*
* @dataProvider providerTestSetOptionDefault
* @covers ::setOptionDefaults
*/
public function testSetOptionDefault($storage, $definition, $expected) {
$this->testHelperPlugin->testSetOptionDefaults($storage, $definition);
......@@ -286,9 +284,8 @@ public function providerTestSetOptionDefault() {
}
/**
* Tests filterByDefinedOptions().
*
* @dataProvider providerTestFilterByDefinedOptions
* @covers ::filterByDefinedOptions
*/
public function testFilterByDefinedOptions($storage, $options, $expected_storage) {
$this->testHelperPlugin->setDefinedOptions($options);
......
......@@ -245,7 +245,7 @@ public function testGetUrlWithPlaceholdersAndWithoutArgsAndExceptionValue() {
}
/**
* Tests the buildThemeFunctions() method.
* @covers ::buildThemeFunctions
*/
public function testBuildThemeFunctions() {
/** @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject $view */
......@@ -289,9 +289,7 @@ public function testBuildThemeFunctions() {
}
/**
* Tests the generateHandlerId method().
*
* @covers ::generateHandlerId()
* @covers ::generateHandlerId
*/
public function testGenerateHandlerId() {
// Test the generateHandlerId() method.
......@@ -301,9 +299,7 @@ public function testGenerateHandlerId() {
}
/**
* Tests the addHandler method().
*
* @covers ::addHandler()
* @covers ::addHandler
*/
public function testAddHandler() {
/** @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject $view */
......@@ -342,9 +338,7 @@ public function testAddHandler() {
}
/**
* Tests the addHandler method() with an entity field.
*
* @covers ::addHandler()
* @covers ::addHandler
*/
public function testAddHandlerWithEntityField() {
/** @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject $view */
......@@ -387,9 +381,7 @@ public function testAddHandlerWithEntityField() {
}
/**
* Tests attachDisplays().
*
* @covers ::attachDisplays()
* @covers ::attachDisplays
*/
public function testAttachDisplays() {
/** @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject $view */
......
......@@ -11,7 +11,7 @@
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\Component\Plugin\DefaultFactory
* @coversDefaultClass \Drupal\Component\Plugin\Factory\DefaultFactory
* @group Plugin
*/
class DefaultFactoryTest extends UnitTestCase {
......
......@@ -16,12 +16,8 @@
class PluginBaseTest extends UnitTestCase {
/**
* Tests the getPluginId method.
*
* @dataProvider providerTestGetPluginId
*
* @see \Drupal\Component\Plugin\PluginBase::getPluginId()
*
* @covers ::getPluginId
*/
public function testGetPluginId($plugin_id, $expected) {
$plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', array(
......@@ -46,11 +42,8 @@ public function providerTestGetPluginId() {
}
/**
* Tests the getBaseId method.
*
* @dataProvider providerTestGetBaseId
*
* @see \Drupal\Component\Plugin\PluginBase::getBaseId()
* @coves ::getBaseId
*/
public function testGetBaseId($plugin_id, $expected) {
/** @var \Drupal\Component\Plugin\PluginBase|\PHPUnit_Framework_MockObject_MockObject $plugin_base */
......@@ -77,11 +70,8 @@ public function providerTestGetBaseId() {
/**
* Tests the getDerivativeId method.
*
* @dataProvider providerTestGetDerivativeId
*
* @see \Drupal\Component\Plugin\PluginBase::getDerivativeId()
* @covers ::getDerivativeId
*/
public function testGetDerivativeId($plugin_id = NULL, $expected = NULL) {
/** @var \Drupal\Component\Plugin\PluginBase|\PHPUnit_Framework_MockObject_MockObject $plugin_base */
......@@ -107,9 +97,7 @@ public function providerTestGetDerivativeId() {
}
/**
* Tests the getPluginDefinition method.
*
* @see \Drupal\Component\Plugin\PluginBase::getPluginDefinition()
* @covers ::getPluginDefinition
*/
public function testGetPluginDefinition() {
$plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', array(
......
......@@ -33,7 +33,7 @@ protected function setUp() {
}
/**
* @covers ::buildProxyClassName()
* @covers ::buildProxyClassName
*/
public function testBuildProxyClassName() {
$class_name = $this->proxyBuilder->buildProxyClassName('Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod');
......@@ -43,9 +43,9 @@ public function testBuildProxyClassName() {
/**
* Tests the basic methods like the constructor and the lazyLoadItself method.
*
* @covers ::build()
* @covers ::buildConstructorMethod()
* @covers ::buildLazyLoadItselfMethod()
* @covers ::build
* @covers ::buildConstructorMethod
* @covers ::buildLazyLoadItselfMethod
*/
public function testBuildNoMethod() {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod';
......@@ -55,8 +55,8 @@ public function testBuildNoMethod() {
}
/**
* @covers ::buildMethod()
* @covers ::buildMethodBody()
* @covers ::buildMethod
* @covers ::buildMethodBody
*/
public function testBuildSimpleMethod() {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceSimpleMethod';
......@@ -75,9 +75,9 @@ public function method()
}
/**
* @covers ::buildMethod()
* @covers ::buildParameter()
* @covers ::buildMethodBody()
* @covers ::buildMethod
* @covers ::buildParameter
* @covers ::buildMethodBody
*/
public function testBuildMethodWithParameter() {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceMethodWithParameter';
......@@ -96,9 +96,9 @@ public function methodWithParameter($parameter)
}
/**
* @covers ::buildMethod()
* @covers ::buildParameter()
* @covers ::buildMethodBody()
* @covers ::buildMethod
* @covers ::buildParameter
* @covers ::buildMethodBody
*/
public function testBuildComplexMethod() {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceComplexMethod';
......@@ -120,8 +120,8 @@ public function complexMethod($parameter, callable $function, \Drupal\Tests\Comp
}
/**
* @covers ::buildMethod()
* @covers ::buildMethodBody()
* @covers ::buildMethod
* @covers ::buildMethodBody
*/
public function testBuildReturnReference() {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceReturnReference';
......@@ -142,9 +142,9 @@ public function &returnReference()
}
/**
* @covers ::buildMethod()
* @covers ::buildParameter()
* @covers ::buildMethodBody()
* @covers ::buildMethod
* @covers ::buildParameter
* @covers ::buildMethodBody
*/
public function testBuildWithInterface() {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithInterface';
......@@ -165,7 +165,7 @@ public function testMethod($parameter)
}
/**
* @covers ::build()
* @covers ::build
*/
public function testBuildWithNestedInterface() {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithChildInterfaces';
......@@ -178,9 +178,9 @@ public function testBuildWithNestedInterface() {
}
/**
* @covers ::buildMethod()
* @covers ::buildParameter()
* @covers ::buildMethodBody()
* @covers ::buildMethod
* @covers ::buildParameter
* @covers ::buildMethodBody
*/
public function testBuildWithProtectedAndPrivateMethod() {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithProtectedMethods';
......@@ -200,9 +200,9 @@ public function testMethod($parameter)
}
/**
* @covers ::buildMethod()
* @covers ::buildParameter()
* @covers ::buildMethodBody()
* @covers ::buildMethod
* @covers ::buildParameter
* @covers ::buildMethodBody
*/
public function testBuildWithPublicStaticMethod() {
$class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithPublicStaticMethod';
......
......@@ -46,7 +46,7 @@ protected function setUp() {
/**
* @dataProvider providerTestIsProxyCandidate
* @covers ::isProxyCandidate()
* @covers ::isProxyCandidate
*/
public function testIsProxyCandidate(Definition $definition, $expected) {
$this->assertSame($expected, $this->proxyDumper->isProxyCandidate($definition));
......@@ -86,7 +86,7 @@ public function testGetProxyFactoryCode() {
}
/**
* @covers ::getProxyCode()
* @covers ::getProxyCode
*/
public function testGetProxyCode() {
$definition = new Definition('Drupal\Tests\Component\ProxyBuilder\TestService');
......@@ -103,7 +103,7 @@ public function testGetProxyCode() {
}
/**
* @covers ::getProxyCode()
* @covers ::getProxyCode
*/
public function testGetProxyCodeWithSameClassMultipleTimes() {
$definition = new Definition('Drupal\Tests\Component\ProxyBuilder\TestService');
......
......@@ -114,7 +114,7 @@ public function providerTestGetLibrariesWithDependencies() {
}
/**
* @covers ::getLibrariesWithDependencies()
* @covers ::getLibrariesWithDependencies
*
* @dataProvider providerTestGetLibrariesWithDependencies
*/
......@@ -166,7 +166,7 @@ public function providerTestGetMinimalRepresentativeSubset() {
}
/**
* @covers ::getMinimalRepresentativeSubset()
* @covers ::getMinimalRepresentativeSubset
*
* @dataProvider providerTestGetMinimalRepresentativeSubset
*/
......
......@@ -71,7 +71,7 @@ protected function setUp() {
}
/**
* @covers ::getLibrariesByExtension()
* @covers ::getLibrariesByExtension
*/
public function testGetLibrariesByExtension() {
$this->libraryDiscoveryCollector->expects($this->once())
......
......@@ -11,7 +11,7 @@
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\Component\Batch\Batch
* @coversDefaultClass \Drupal\Core\Batch\Percentage
* @group Batch
*
* Tests the Batch helper object to make sure that the rounding works properly
......@@ -21,11 +21,8 @@ class PercentagesTest extends UnitTestCase {
protected $testCases = array();
/**
* Tests the format() function.
*
* @dataProvider providerTestPercentages
*
* @see \Drupal\Core\Batch\Percentage::format()
* @covers ::format
*/
public function testPercentages($total, $current, $expected_result) {
$actual_result = Percentage::format($total, $current);
......
......@@ -10,14 +10,14 @@
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\entity\EntityDisplayBase
* @coversDefaultClass \Drupal\Core\Entity\EntityDisplayBase
*
* @group Config
*/
class EntityDisplayBaseTest extends UnitTestCase {
/**
* @covers ::getTargetEntityTypeId()
* @covers ::getTargetEntityTypeId
*/
public function testGetTargetEntityTypeId() {
$mock = $this->getMockForAbstractClass('\Drupal\Core\Entity\EntityDisplayBase', [], '', FALSE);
......@@ -28,7 +28,7 @@ public function testGetTargetEntityTypeId() {
}
/**
* @covers ::getMode()
* @covers ::getMode
*/
public function testGetMode() {
$mock = $this->getMockForAbstractClass('\Drupal\Core\Entity\EntityDisplayBase', [], '', FALSE);
......@@ -39,7 +39,7 @@ public function testGetMode() {
}
/**
* @covers ::getOriginalMode()
* @covers ::getOriginalMode
*/
public function testGetOriginalMode() {
$mock = $this->getMockForAbstractClass('\Drupal\Core\Entity\EntityDisplayBase', [], '', FALSE);
......@@ -50,9 +50,9 @@ public function testGetOriginalMode() {
}
/**
* @covers ::getDisplayBundle()
* @covers ::getTargetBundle
*/
public function testGetDisplayBundle() {
public function testGetTargetBundle() {
$mock = $this->getMockForAbstractClass('\Drupal\Core\Entity\EntityDisplayBase', [], '', FALSE);
$reflection = new \ReflectionProperty($mock, 'bundle');
$reflection->setAccessible(TRUE);
......@@ -61,9 +61,9 @@ public function testGetDisplayBundle() {
}
/**
* @covers ::setDisplayBundle()
* @covers ::setTargetBundle
*/
public function testSetDisplayBundle() {
public function testSetTargetBundle() {
$mock = $this->getMockForAbstractClass('\Drupal\Core\Entity\EntityDisplayBase', [], '', FALSE);
$reflection = new \ReflectionProperty($mock, 'bundle');
$reflection->setAccessible(TRUE);
......
......@@ -11,7 +11,7 @@
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\Core\Datetime\Date
* @coversDefaultClass \Drupal\Core\Datetime\DateFormatter
* @group Datetime
*/
class DateTest extends UnitTestCase {
......
......@@ -20,7 +20,7 @@ class DiscoverServiceProvidersTest extends UnitTestCase {
/**
* Tests discovery with user defined container yaml.
*
* @covers ::discoverServiceProviders()
* @covers ::discoverServiceProviders
*/
public function testDiscoverServiceCustom() {
new Settings(array(
......@@ -47,7 +47,7 @@ public function testDiscoverServiceCustom() {
/**
* Tests the exception when container_yamls is not set.
*
* @covers ::discoverServiceProviders()
* @covers ::discoverServiceProviders
* @expectedException \Exception
*/
public function testDiscoverServiceNoContainerYamls() {
......
......@@ -20,8 +20,7 @@ class DrupalKernelTrustedHostsTest extends UnitTestCase {
/**
* Tests hostname validation with settings.
*
* @covers ::setupTrustedHosts()
*
* @covers ::setupTrustedHosts
* @dataProvider providerTestTrustedHosts
*/
public function testTrustedHosts($host, $server_name, $message, $expected = FALSE) {
......
......@@ -18,10 +18,7 @@
class ValidateHostnameTest extends UnitTestCase {
/**
* Tests hostname validation.
*
* @covers ::validateHostname()
*
* @covers ::validateHostname
* @dataProvider providerTestValidateHostname
*/
public function testValidateHostname($hostname, $message, $expected = FALSE) {
......
......@@ -13,9 +13,8 @@
use Symfony\Component\HttpFoundation\Request;
/**
* Tests the contextual link default class.
*
* @group Menu
* @coversDefaultClass \Drupal\Core\Menu\ContextualLinkDefault
*/
class ContextualLinkDefaultTest extends UnitTestCase {
......@@ -68,9 +67,7 @@ protected function setupContextualLinkDefault() {
}
/**
* Tests the getTitle method without a translation context.
*
* @see \Drupal\Core\Menu\LocalTaskDefault::getTitle()
* @covers ::getTitle
*/
public function testGetTitle($title = 'Example') {
$this->pluginDefinition['title'] = $title;
......@@ -84,9 +81,7 @@ public function testGetTitle($title = 'Example') {
}
/**
* Tests the getTitle method with a translation context.
*
* @see \Drupal\Core\Menu\LocalTaskDefault::getTitle()
* @covers ::getTitle
*/
public function testGetTitleWithContext() {
$this->pluginDefinition['title'] = 'Example';
......@@ -101,7 +96,7 @@ public function testGetTitleWithContext() {
}
/**
* Tests the getTitle method with title arguments.
* @covers ::getTitle
*/
public function testGetTitleWithTitleArguments() {
$this->pluginDefinition['title'] = 'Example @test';
......@@ -117,8 +112,6 @@ public function testGetTitleWithTitleArguments() {
}
/**
* Tests the getRouteName() method.
*
* @covers ::getRouteName
*/
public function testGetRouteName($route_name = 'test_route_name') {
......@@ -129,8 +122,6 @@ public function testGetRouteName($route_name = 'test_route_name') {
}
/**
* Tests the getGroup() method.
*
* @covers ::getGroup
*/
public function testGetGroup($group_name = 'test_group') {
......@@ -141,8 +132,6 @@ public function testGetGroup($group_name = 'test_group') {
}
/**
* Tests the getOptions() method.
*
* @covers ::getOptions
*/
public function testGetOptions($options = array('key' => 'value')) {
......@@ -153,8 +142,6 @@ public function testGetOptions($options = array('key' => 'value')) {
}
/**
* Tests the getWeight() method.
*
* @covers ::getWeight
*/
public function testGetWeight($weight = 5) {
......
......@@ -15,7 +15,7 @@
use Symfony\Component\Routing\Route;
/**
* @coversDefaultClass \Drupal\Core\Menu\LocalTaskDefaultTest
* @coversDefaultClass \Drupal\Core\Menu\LocalTaskDefault
* @group Menu
*/
class LocalTaskDefaultTest extends UnitTestCase {
......@@ -83,9 +83,7 @@ protected function setupLocalTaskDefault() {
}
/**
* Tests the getRouteParameters for a static route.
*
* @see \Drupal\Core\Menu\LocalTaskDefault::getRouteParameters()
* @covers ::getRouteParameters
*/
public function testGetRouteParametersForStaticRoute() {
$this->pluginDefinition = array(
......@@ -104,7 +102,7 @@ public function testGetRouteParametersForStaticRoute() {
}
/**
* Tests the getRouteParameters for a route with the parameters in the plugin definition.
* @covers ::getRouteParameters
*/
public function testGetRouteParametersInPluginDefinitions() {
$this->pluginDefinition = array(
......@@ -124,11 +122,9 @@ public function testGetRouteParametersInPluginDefinitions() {
}
/**
* Tests the getRouteParameters method for a route with dynamic non upcasted parameters.
*
* @see \Drupal\Core\Menu\LocalTaskDefault::getRouteParameters()
* @covers ::getRouteParameters
*/
public function testGetRouteParametersForDynamicRoute() {
public function testGetRouteParametersForDynamicRouteWithNonUpcastedParameters() {
$this->pluginDefinition = array(
'route_name' => 'test_route'
);
......@@ -149,7 +145,7 @@ public function testGetRouteParametersForDynamicRoute() {
/**
* Tests the getRouteParameters method for a route with upcasted parameters.
*
* @see \Drupal\Core\Menu\LocalTaskDefault::getRouteParameters()
* @covers ::getRouteParameters
*/
public function testGetRouteParametersForDynamicRouteWithUpcastedParameters() {
$this->pluginDefinition = array(
......@@ -169,9 +165,7 @@ public function testGetRouteParametersForDynamicRouteWithUpcastedParameters() {
}
/**
* Defines a test provider for getWeight()
*
* @see self::getWeight()
* Defines a data provider for testGetWeight().
*
* @return array
* A list or test plugin definition and expected weight.
......@@ -214,11 +208,8 @@ public function providerTestGetWeight() {
}
/**
* Tests the getWeight method.
*