Révision 5587145e
Ajouté par Assos Assos il y a presque 7 ans
drupal7/modules/simpletest/drupal_web_test_case.php | ||
---|---|---|
39 | 39 |
*/ |
40 | 40 |
protected $originalFileDirectory = NULL; |
41 | 41 |
|
42 |
/** |
|
43 |
* URL to the verbose output file directory. |
|
44 |
* |
|
45 |
* @var string |
|
46 |
*/ |
|
47 |
protected $verboseDirectoryUrl; |
|
48 |
|
|
42 | 49 |
/** |
43 | 50 |
* Time limit for the test. |
44 | 51 |
*/ |
... | ... | |
461 | 468 |
protected function verbose($message) { |
462 | 469 |
if ($id = simpletest_verbose($message)) { |
463 | 470 |
$class_safe = str_replace('\\', '_', get_class($this)); |
464 |
$url = file_create_url($this->originalFileDirectory . '/simpletest/verbose/' . $class_safe . '-' . $id . '.html'); |
|
465 |
$this->error(l(t('Verbose message'), $url, array('attributes' => array('target' => '_blank'))), 'User notice'); |
|
471 |
$url = $this->verboseDirectoryUrl . '/' . $class_safe . '-' . $id . '.html'; |
|
472 |
// Not using l() to avoid invoking the theme system, so that unit tests |
|
473 |
// can use verbose() as well. |
|
474 |
$link = '<a href="' . $url . '" target="_blank">' . t('Verbose message') . '</a>'; |
|
475 |
$this->error($link, 'User notice'); |
|
466 | 476 |
} |
467 | 477 |
} |
468 | 478 |
|
... | ... | |
719 | 729 |
* method. |
720 | 730 |
*/ |
721 | 731 |
protected function setUp() { |
722 |
global $conf; |
|
732 |
global $conf, $language;
|
|
723 | 733 |
|
724 | 734 |
// Store necessary current values before switching to the test environment. |
725 | 735 |
$this->originalFileDirectory = variable_get('file_public_path', conf_path() . '/files'); |
736 |
$this->verboseDirectoryUrl = file_create_url($this->originalFileDirectory . '/simpletest/verbose'); |
|
737 |
|
|
738 |
// Set up English language. |
|
739 |
$this->originalLanguage = $language; |
|
740 |
$this->originalLanguageDefault = variable_get('language_default'); |
|
741 |
unset($conf['language_default']); |
|
742 |
$language = language_default(); |
|
726 | 743 |
|
727 | 744 |
// Reset all statics so that test is performed with a clean environment. |
728 | 745 |
drupal_static_reset(); |
... | ... | |
764 | 781 |
} |
765 | 782 |
|
766 | 783 |
protected function tearDown() { |
767 |
global $conf; |
|
784 |
global $conf, $language;
|
|
768 | 785 |
|
769 | 786 |
// Get back to the original connection. |
770 | 787 |
Database::removeConnection('default'); |
... | ... | |
775 | 792 |
if (isset($this->originalModuleList)) { |
776 | 793 |
module_list(TRUE, FALSE, FALSE, $this->originalModuleList); |
777 | 794 |
} |
795 |
|
|
796 |
// Reset language. |
|
797 |
$language = $this->originalLanguage; |
|
798 |
if ($this->originalLanguageDefault) { |
|
799 |
$GLOBALS['conf']['language_default'] = $this->originalLanguageDefault; |
|
800 |
} |
|
778 | 801 |
} |
779 | 802 |
} |
780 | 803 |
|
... | ... | |
1381 | 1404 |
$this->originalLanguageUrl = $language_url; |
1382 | 1405 |
$this->originalLanguageDefault = variable_get('language_default'); |
1383 | 1406 |
$this->originalFileDirectory = variable_get('file_public_path', conf_path() . '/files'); |
1407 |
$this->verboseDirectoryUrl = file_create_url($this->originalFileDirectory . '/simpletest/verbose'); |
|
1384 | 1408 |
$this->originalProfile = drupal_get_profile(); |
1385 | 1409 |
$this->originalCleanUrl = variable_get('clean_url', 0); |
1386 | 1410 |
$this->originalUser = $user; |
Formats disponibles : Unified diff
Update to 7.56