Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
c1b037d6
Commit
c1b037d6
authored
Nov 18, 2014
by
alexpott
Browse files
Issue
#2364555
by Mile23: Add @covers annotation, fix some --strict for PHPUnit
parent
169fde0e
Changes
7
Hide whitespace changes
Inline
Side-by-side
core/tests/Drupal/Tests/Core/Cache/CacheTest.php
View file @
c1b037d6
...
...
@@ -53,7 +53,8 @@ public function testValidateTags(array $tags, $expected_exception_message) {
if
(
$expected_exception_message
!==
FALSE
)
{
$this
->
setExpectedException
(
'LogicException'
,
$expected_exception_message
);
}
Cache
::
validateTags
(
$tags
);
// If it doesn't throw an exception, validateTags() returns NULL.
$this
->
assertNull
(
Cache
::
validateTags
(
$tags
));
}
/**
...
...
core/tests/Drupal/Tests/Core/DrupalTest.php
View file @
c1b037d6
...
...
@@ -34,6 +34,8 @@ protected function setUp() {
/**
* Tests the get/setContainer() method.
*
* @covers ::getContainer
*/
public
function
testSetContainer
()
{
\
Drupal
::
setContainer
(
$this
->
container
);
...
...
@@ -42,6 +44,8 @@ public function testSetContainer() {
/**
* Tests the service() method.
*
* @covers ::service
*/
public
function
testService
()
{
$this
->
setMockContainerService
(
'test_service'
);
...
...
@@ -50,6 +54,8 @@ public function testService() {
/**
* Tests the currentUser() method.
*
* @covers ::currentUser
*/
public
function
testCurrentUser
()
{
$this
->
setMockContainerService
(
'current_user'
);
...
...
@@ -58,6 +64,8 @@ public function testCurrentUser() {
/**
* Tests the entityManager() method.
*
* @covers ::entityManager
*/
public
function
testEntityManager
()
{
$this
->
setMockContainerService
(
'entity.manager'
);
...
...
@@ -66,6 +74,8 @@ public function testEntityManager() {
/**
* Tests the database() method.
*
* @covers ::database
*/
public
function
testDatabase
()
{
$this
->
setMockContainerService
(
'database'
);
...
...
@@ -74,6 +84,8 @@ public function testDatabase() {
/**
* Tests the service() method.
*
* @covers ::cache
*/
public
function
testCache
()
{
$this
->
setMockContainerService
(
'cache.test'
);
...
...
@@ -82,6 +94,8 @@ public function testCache() {
/**
* Tests the keyValueExpirable() method.
*
* @covers ::keyValueExpirable
*/
public
function
testKeyValueExpirable
()
{
$keyvalue
=
$this
->
getMockBuilder
(
'Drupal\Core\KeyValueStore\KeyValueExpirableFactory'
)
...
...
@@ -98,6 +112,8 @@ public function testKeyValueExpirable() {
/**
* Tests the lock() method.
*
* @covers ::lock
*/
public
function
testLock
()
{
$this
->
setMockContainerService
(
'lock'
);
...
...
@@ -106,6 +122,8 @@ public function testLock() {
/**
* Tests the config() method.
*
* @covers ::config
*/
public
function
testConfig
()
{
$config
=
$this
->
getMock
(
'Drupal\Core\Config\ConfigFactoryInterface'
);
...
...
@@ -120,6 +138,8 @@ public function testConfig() {
/**
* Tests the queue() method.
*
* @covers ::queue
*/
public
function
testQueue
()
{
$queue
=
$this
->
getMockBuilder
(
'Drupal\Core\Queue\QueueFactory'
)
...
...
@@ -148,6 +168,8 @@ public function testRequestStack() {
/**
* Tests the keyValue() method.
*
* @covers ::keyValue
*/
public
function
testKeyValue
()
{
$keyvalue
=
$this
->
getMockBuilder
(
'Drupal\Core\KeyValueStore\KeyValueFactory'
)
...
...
@@ -164,6 +186,8 @@ public function testKeyValue() {
/**
* Tests the state() method.
*
* @covers ::state
*/
public
function
testState
()
{
$this
->
setMockContainerService
(
'state'
);
...
...
@@ -172,6 +196,8 @@ public function testState() {
/**
* Tests the httpClient() method.
*
* @covers ::httpClient
*/
public
function
testHttpClient
()
{
$this
->
setMockContainerService
(
'http_client'
);
...
...
@@ -180,6 +206,8 @@ public function testHttpClient() {
/**
* Tests the entityQuery() method.
*
* @covers ::entityQuery
*/
public
function
testEntityQuery
()
{
$query
=
$this
->
getMockBuilder
(
'Drupal\Core\Entity\Query\QueryFactory'
)
...
...
@@ -196,6 +224,8 @@ public function testEntityQuery() {
/**
* Tests the entityQueryAggregate() method.
*
* @covers ::entityQueryAggregate
*/
public
function
testEntityQueryAggregate
()
{
$query
=
$this
->
getMockBuilder
(
'Drupal\Core\Entity\Query\QueryFactory'
)
...
...
@@ -212,6 +242,8 @@ public function testEntityQueryAggregate() {
/**
* Tests the flood() method.
*
* @covers ::flood
*/
public
function
testFlood
()
{
$this
->
setMockContainerService
(
'flood'
);
...
...
@@ -220,6 +252,8 @@ public function testFlood() {
/**
* Tests the moduleHandler() method.
*
* @covers ::moduleHandler
*/
public
function
testModuleHandler
()
{
$this
->
setMockContainerService
(
'module_handler'
);
...
...
@@ -227,7 +261,9 @@ public function testModuleHandler() {
}
/**
* Tests the typedData() method.
* Tests the typedDataManager() method.
*
* @covers ::typedDataManager
*/
public
function
testTypedDataManager
()
{
$this
->
setMockContainerService
(
'typed_data_manager'
);
...
...
@@ -236,6 +272,8 @@ public function testTypedDataManager() {
/**
* Tests the token() method.
*
* @covers ::token
*/
public
function
testToken
()
{
$this
->
setMockContainerService
(
'token'
);
...
...
@@ -244,6 +282,8 @@ public function testToken() {
/**
* Tests the urlGenerator() method.
*
* @covers ::urlGenerator
*/
public
function
testUrlGenerator
()
{
$this
->
setMockContainerService
(
'url_generator'
);
...
...
@@ -253,6 +293,7 @@ public function testUrlGenerator() {
/**
* Tests the _url() method.
*
* @covers ::url
* @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute()
*/
public
function
testUrl
()
{
...
...
@@ -270,6 +311,8 @@ public function testUrl() {
/**
* Tests the linkGenerator() method.
*
* @covers ::linkGenerator
*/
public
function
testLinkGenerator
()
{
$this
->
setMockContainerService
(
'link_generator'
);
...
...
@@ -277,8 +320,9 @@ public function testLinkGenerator() {
}
/**
* Tests the
_
l() method.
* Tests the l() method.
*
* @covers ::l
* @see \Drupal\Core\Utility\LinkGeneratorInterface::generate()
*/
public
function
testL
()
{
...
...
@@ -297,6 +341,8 @@ public function testL() {
/**
* Tests the translation() method.
*
* @covers ::translation
*/
public
function
testTranslation
()
{
$this
->
setMockContainerService
(
'string_translation'
);
...
...
@@ -305,6 +351,8 @@ public function testTranslation() {
/**
* Tests the languageManager() method.
*
* @covers ::languageManager
*/
public
function
testLanguageManager
()
{
$this
->
setMockContainerService
(
'language_manager'
);
...
...
@@ -313,6 +361,8 @@ public function testLanguageManager() {
/**
* Tests the csrfToken() method.
*
* @covers ::csrfToken
*/
public
function
testCsrfToken
()
{
$this
->
setMockContainerService
(
'csrf_token'
);
...
...
@@ -321,6 +371,8 @@ public function testCsrfToken() {
/**
* Tests the transliteration() method.
*
* @covers ::transliteration
*/
public
function
testTransliteration
()
{
$this
->
setMockContainerService
(
'transliteration'
);
...
...
@@ -329,6 +381,8 @@ public function testTransliteration() {
/**
* Tests the formBuilder() method.
*
* @covers ::formBuilder
*/
public
function
testFormBuilder
()
{
$this
->
setMockContainerService
(
'form_builder'
);
...
...
@@ -337,6 +391,8 @@ public function testFormBuilder() {
/**
* Tests the menuTree() method.
*
* @covers ::menuTree
*/
public
function
testMenuTree
()
{
$this
->
setMockContainerService
(
'menu.link_tree'
);
...
...
@@ -345,6 +401,8 @@ public function testMenuTree() {
/**
* Tests the pathValidator() method.
*
* @covers ::pathValidator
*/
public
function
testPathValidator
()
{
$this
->
setMockContainerService
(
'path.validator'
);
...
...
@@ -353,6 +411,8 @@ public function testPathValidator() {
/**
* Tests the accessManager() method.
*
* @covers ::accessManager
*/
public
function
testAccessManager
()
{
$this
->
setMockContainerService
(
'access_manager'
);
...
...
core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php
View file @
c1b037d6
...
...
@@ -295,7 +295,8 @@ public function testCustomStorage() {
public
function
testDefaultValueCallback
()
{
$definition
=
BaseFieldDefinition
::
create
(
$this
->
fieldType
);
$callback
=
get_class
(
$this
)
.
'::mockDefaultValueCallback'
;
$definition
->
setDefaultValueCallback
(
$callback
);
// setDefaultValueCallback returns $this.
$this
->
assertSame
(
$definition
,
$definition
->
setDefaultValueCallback
(
$callback
));
}
/**
...
...
@@ -306,7 +307,10 @@ public function testDefaultValueCallback() {
*/
public
function
testInvalidDefaultValueCallback
()
{
$definition
=
BaseFieldDefinition
::
create
(
$this
->
fieldType
);
$definition
->
setDefaultValueCallback
([
get_class
(
$this
),
'mockDefaultValueCallback'
]);
// setDefaultValueCallback returns $this.
$this
->
assertSame
(
$definition
,
$definition
->
setDefaultValueCallback
([
get_class
(
$this
),
'mockDefaultValueCallback'
])
);
}
/**
...
...
@@ -316,7 +320,8 @@ public function testInvalidDefaultValueCallback() {
*/
public
function
testNullDefaultValueCallback
()
{
$definition
=
BaseFieldDefinition
::
create
(
$this
->
fieldType
);
$definition
->
setDefaultValueCallback
(
NULL
);
// setDefaultValueCallback returns $this.
$this
->
assertSame
(
$definition
,
$definition
->
setDefaultValueCallback
(
NULL
));
}
/**
...
...
core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php
View file @
c1b037d6
...
...
@@ -92,6 +92,7 @@ protected function setUp() {
* @covers ::addDefaultLangcodeSchema()
* @covers ::processBaseTable()
* @covers ::processIdentifierSchema()
* @covers ::onEntityTypeCreate()
*/
public
function
testGetSchemaBase
()
{
$this
->
entityType
=
new
ContentEntityType
(
array
(
...
...
@@ -380,7 +381,9 @@ public function testGetSchemaBase() {
->
method
(
'getTableMapping'
)
->
will
(
$this
->
returnValue
(
$table_mapping
));
$this
->
storageSchema
->
onEntityTypeCreate
(
$this
->
entityType
);
$this
->
assertNull
(
$this
->
storageSchema
->
onEntityTypeCreate
(
$this
->
entityType
)
);
}
/**
...
...
@@ -394,6 +397,7 @@ public function testGetSchemaBase() {
* @covers ::getEntityIndexName()
* @covers ::processRevisionTable()
* @covers ::processIdentifierSchema()
* @covers ::onEntityTypeCreate()
*/
public
function
testGetSchemaRevisionable
()
{
$this
->
entityType
=
new
ContentEntityType
(
array
(
...
...
@@ -568,7 +572,9 @@ public function testGetSchemaTranslatable() {
->
method
(
'getTableMapping'
)
->
will
(
$this
->
returnValue
(
$table_mapping
));
$this
->
storageSchema
->
onEntityTypeCreate
(
$this
->
entityType
);
$this
->
assertNull
(
$this
->
storageSchema
->
onEntityTypeCreate
(
$this
->
entityType
)
);
}
/**
...
...
@@ -759,8 +765,7 @@ public function testGetSchemaRevisionableTranslatable() {
/**
* Tests the schema for a field dedicated table.
*
* @covers ::getDedicatedTableSchema()
* @covers ::createDedicatedTableSchema()
* @covers ::onFieldStorageDefinitionCreate
*/
public
function
testDedicatedTableSchema
()
{
$entity_type_id
=
'entity_test'
;
...
...
@@ -898,14 +903,15 @@ public function testDedicatedTableSchema() {
->
method
(
'getTableMapping'
)
->
will
(
$this
->
returnValue
(
$table_mapping
));
$this
->
storageSchema
->
onFieldStorageDefinitionCreate
(
$field_storage
);
$this
->
assertNull
(
$this
->
storageSchema
->
onFieldStorageDefinitionCreate
(
$field_storage
)
);
}
/**
* Tests the schema for a field dedicated table for an entity with a string identifier.
*
* @covers ::getDedicatedTableSchema()
* @covers ::createDedicatedTableSchema()
* @covers ::onFieldStorageDefinitionCreate
*/
public
function
testDedicatedTableSchemaForEntityWithStringIdentifier
()
{
$entity_type_id
=
'entity_test'
;
...
...
@@ -1043,7 +1049,9 @@ public function testDedicatedTableSchemaForEntityWithStringIdentifier() {
->
method
(
'getTableMapping'
)
->
will
(
$this
->
returnValue
(
$table_mapping
));
$this
->
storageSchema
->
onFieldStorageDefinitionCreate
(
$field_storage
);
$this
->
assertNull
(
$this
->
storageSchema
->
onFieldStorageDefinitionCreate
(
$field_storage
)
);
}
/**
...
...
core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
View file @
c1b037d6
...
...
@@ -218,7 +218,7 @@ public function testCreateInstanceWithJustValidInterfaces() {
$plugin_manager
=
new
TestPluginManager
(
$this
->
namespaces
,
$this
->
expectedDefinitions
,
NULL
,
NULL
,
'\Drupal\plugin_test\Plugin\plugin_test\fruit\FruitInterface'
);
foreach
(
$this
->
expectedDefinitions
as
$plugin_id
=>
$definition
)
{
$plugin_manager
->
createInstance
(
$plugin_id
);
$this
->
assertNotNull
(
$plugin_manager
->
createInstance
(
$plugin_id
)
)
;
}
}
...
...
@@ -276,7 +276,7 @@ public function testGetDefinitionsWithoutRequiredInterface() {
$this
->
expectedDefinitions
[
'banana'
][
'provider'
]
=
'plugin_test'
;
$plugin_manager
=
new
TestPluginManager
(
$this
->
namespaces
,
$this
->
expectedDefinitions
,
$module_handler
,
NULL
);
$plugin_manager
->
getDefinitions
();
$this
->
assertInternalType
(
'array'
,
$plugin_manager
->
getDefinitions
()
)
;
}
}
core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php
View file @
c1b037d6
...
...
@@ -14,7 +14,7 @@
use
Symfony\Component\Routing\Route
;
/**
* @coversDefaultClass \Drupal\Core\Routing\Router
* @coversDefaultClass \Drupal\Core\Routing\
AccessAware
Router
* @group Routing
*/
class
AccessAwareRouterTest
extends
UnitTestCase
{
...
...
core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php
View file @
c1b037d6
...
...
@@ -51,7 +51,7 @@ public function testNoProxy() {
/**
* Tests that subscriber sets trusted headers when reverse proxy is set.
*
* @dataProvider
testR
everseProxyEnabledProvider
* @dataProvider
r
everseProxyEnabledProvider
*/
public
function
testReverseProxyEnabled
(
$provided_settings
)
{
// Enable reverse proxy and add test values.
...
...
@@ -62,7 +62,7 @@ public function testReverseProxyEnabled($provided_settings) {
/**
* Data provider for testReverseProxyEnabled.
*/
public
function
testR
everseProxyEnabledProvider
()
{
public
function
r
everseProxyEnabledProvider
()
{
return
array
(
array
(
array
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment