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
063fe482
Commit
063fe482
authored
Oct 15, 2010
by
webchick
Browse files
#742972
follow-up by klausi, sun: Fix documentation and tests regarding entity cache clearing.
parent
6c2b8b7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/simpletest/tests/entity_cache_test.module
View file @
063fe482
...
...
@@ -9,14 +9,20 @@
/**
* Implements hook_watchdog().
*
* This function is called during module_enable() and tries to access entity
* information provided by the module this one depends on. The information is
* stored in a temporary system variable and is later analyzed in the test
* case.
* This hook is called during module_enable() and since this hook
* implementation is invoked, we have to expect that this module and dependent
* modules have been properly installed already. So we expect to be able to
* retrieve the entity information that has been registered by the required
* dependency module.
*
* @see EnableDisableTestCase::testEntityCache()
* @see entity_cache_test_dependency_entity_info()
*/
function
entity_cache_test_watchdog
()
{
$info
=
entity_get_info
(
'entity_cache_test'
);
variable_set
(
'entity_cache_test'
,
$info
);
function
entity_cache_test_watchdog
(
$log_entry
)
{
if
(
$log_entry
[
'type'
]
==
'system'
&&
$log_entry
[
'message'
]
==
'%module module installed.'
)
{
$info
=
entity_get_info
(
'entity_cache_test'
);
// Store the information in a system variable to analyze it later in the
// test case.
variable_set
(
'entity_cache_test'
,
$info
);
}
}
modules/system/system.test
View file @
063fe482
...
...
@@ -161,11 +161,14 @@ class EnableDisableTestCase extends ModuleTestCase {
/**
* Tests entity cache after enabling a module with a dependency on an enitity
* providing module.
*
* @see entity_cache_test_watchdog()
*/
function
testEntityCache
()
{
module_enable
(
array
(
'entity_cache_test'
));
$info
=
variable_get
(
'entity_cache_test'
);
$this
->
assertNotNull
(
$info
,
t
(
'Entity information must not be NULL'
));
$this
->
assertEqual
(
$info
[
'label'
],
'Entity Cache Test'
,
'Entity info label is correct.'
);
$this
->
assertEqual
(
$info
[
'controller class'
],
'DrupalDefaultEntityController'
,
'Entity controller class info is correct.'
);
}
}
...
...
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