@@ -447,7 +447,8 @@ abstract class DrupalTestCase {
|
||||
*/
|
||||
protected function verbose($message) {
|
||||
if ($id = simpletest_verbose($message)) {
|
||||
$url = file_create_url($this->originalFileDirectory . '/simpletest/verbose/' . get_class($this) . '-' . $id . '.html');
|
||||
$class_safe = str_replace('\\', '_', get_class($this));
|
||||
$url = file_create_url($this->originalFileDirectory . '/simpletest/verbose/' . $class_safe . '-' . $id . '.html');
|
||||
$this->error(l(t('Verbose message'), $url, array('attributes' => array('target' => '_blank'))), 'User notice');
|
||||
}
|
||||
}
|
||||
@@ -466,7 +467,8 @@ abstract class DrupalTestCase {
|
||||
*/
|
||||
public function run(array $methods = array()) {
|
||||
// Initialize verbose debugging.
|
||||
simpletest_verbose(NULL, variable_get('file_public_path', conf_path() . '/files'), get_class($this));
|
||||
$class = get_class($this);
|
||||
simpletest_verbose(NULL, variable_get('file_public_path', conf_path() . '/files'), str_replace('\\', '_', $class));
|
||||
|
||||
// HTTP auth settings (<username>:<password>) for the simpletest browser
|
||||
// when sending requests to the test site.
|
||||
@@ -478,7 +480,6 @@ abstract class DrupalTestCase {
|
||||
}
|
||||
|
||||
set_error_handler(array($this, 'errorHandler'));
|
||||
$class = get_class($this);
|
||||
// Iterate through all the methods in this class, unless a specific list of
|
||||
// methods to run was passed.
|
||||
$class_methods = get_class_methods($class);
|
||||
@@ -1217,28 +1218,28 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
* $account->pass_raw = $pass_raw;
|
||||
* @endcode
|
||||
*
|
||||
* @param $user
|
||||
* @param $account
|
||||
* User object representing the user to log in.
|
||||
*
|
||||
* @see drupalCreateUser()
|
||||
*/
|
||||
protected function drupalLogin(stdClass $user) {
|
||||
protected function drupalLogin(stdClass $account) {
|
||||
if ($this->loggedInUser) {
|
||||
$this->drupalLogout();
|
||||
}
|
||||
|
||||
$edit = array(
|
||||
'name' => $user->name,
|
||||
'pass' => $user->pass_raw
|
||||
'name' => $account->name,
|
||||
'pass' => $account->pass_raw
|
||||
);
|
||||
$this->drupalPost('user', $edit, t('Log in'));
|
||||
|
||||
// If a "log out" link appears on the page, it is almost certainly because
|
||||
// the login was successful.
|
||||
$pass = $this->assertLink(t('Log out'), 0, t('User %name successfully logged in.', array('%name' => $user->name)), t('User login'));
|
||||
$pass = $this->assertLink(t('Log out'), 0, t('User %name successfully logged in.', array('%name' => $account->name)), t('User login'));
|
||||
|
||||
if ($pass) {
|
||||
$this->loggedInUser = $user;
|
||||
$this->loggedInUser = $account;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2646,10 +2647,9 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
/**
|
||||
* Follows a link by name.
|
||||
*
|
||||
* Will click the first link found with this link text by default, or a
|
||||
* later one if an index is given. Match is case insensitive with
|
||||
* normalized space. The label is translated label. There is an assert
|
||||
* for successful click.
|
||||
* Will click the first link found with this link text by default, or a later
|
||||
* one if an index is given. Match is case sensitive with normalized space.
|
||||
* The label is translated label. There is an assert for successful click.
|
||||
*
|
||||
* @param $label
|
||||
* Text between the anchor tags.
|
||||
@@ -3148,6 +3148,42 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
return $this->assertNotEqual($actual, $title, $message, $group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts themed output.
|
||||
*
|
||||
* @param $callback
|
||||
* The name of the theme function to invoke; e.g. 'links' for theme_links().
|
||||
* @param $variables
|
||||
* An array of variables to pass to the theme function.
|
||||
* @param $expected
|
||||
* The expected themed output string.
|
||||
* @param $message
|
||||
* (optional) A message to display with the assertion. Do not translate
|
||||
* messages: use format_string() to embed variables in the message text, not
|
||||
* t(). If left blank, a default message will be displayed.
|
||||
* @param $group
|
||||
* (optional) The group this message is in, which is displayed in a column
|
||||
* in test output. Use 'Debug' to indicate this is debugging output. Do not
|
||||
* translate this string. Defaults to 'Other'; most tests do not override
|
||||
* this default.
|
||||
*
|
||||
* @return
|
||||
* TRUE on pass, FALSE on fail.
|
||||
*/
|
||||
protected function assertThemeOutput($callback, array $variables = array(), $expected, $message = '', $group = 'Other') {
|
||||
$output = theme($callback, $variables);
|
||||
$this->verbose('Variables:' . '<pre>' . check_plain(var_export($variables, TRUE)) . '</pre>'
|
||||
. '<hr />' . 'Result:' . '<pre>' . check_plain(var_export($output, TRUE)) . '</pre>'
|
||||
. '<hr />' . 'Expected:' . '<pre>' . check_plain(var_export($expected, TRUE)) . '</pre>'
|
||||
. '<hr />' . $output
|
||||
);
|
||||
if (!$message) {
|
||||
$message = '%callback rendered correctly.';
|
||||
}
|
||||
$message = format_string($message, array('%callback' => 'theme_' . $callback . '()'));
|
||||
return $this->assertIdentical($output, $expected, $message, $group);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a field exists in the current page by the given XPath.
|
||||
*
|
||||
|
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\simpletest\Tests;
|
||||
|
||||
class PSR0WebTest extends \DrupalWebTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'PSR0 web test',
|
||||
'description' => 'We want to assert that this PSR-0 test case is being discovered.',
|
||||
'group' => 'SimpleTest',
|
||||
);
|
||||
}
|
||||
|
||||
function testArithmetics() {
|
||||
$this->assert(1 + 1 == 2, '1 + 1 == 2');
|
||||
}
|
||||
}
|
@@ -55,8 +55,8 @@ files[] = tests/upgrade/update.trigger.test
|
||||
files[] = tests/upgrade/update.field.test
|
||||
files[] = tests/upgrade/update.user.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -157,6 +157,7 @@ function simpletest_run_tests($test_list, $reporter = 'drupal') {
|
||||
* Batch operation callback.
|
||||
*/
|
||||
function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
|
||||
simpletest_classloader_register();
|
||||
// Get working values.
|
||||
if (!isset($context['sandbox']['max'])) {
|
||||
// First iteration: initialize working values.
|
||||
@@ -289,6 +290,9 @@ function simpletest_log_read($test_id, $prefix, $test_class, $during_test = FALS
|
||||
* a static variable. In order to list tests provided by disabled modules
|
||||
* hook_registry_files_alter() is used to forcefully add them to the registry.
|
||||
*
|
||||
* PSR-0 classes are found by searching the designated directory for each module
|
||||
* for files matching the PSR-0 standard.
|
||||
*
|
||||
* @return
|
||||
* An array of tests keyed with the groups specified in each of the tests
|
||||
* getInfo() method and then keyed by the test class. An example of the array
|
||||
@@ -309,6 +313,9 @@ function simpletest_test_get_all() {
|
||||
$groups = &drupal_static(__FUNCTION__);
|
||||
|
||||
if (!$groups) {
|
||||
// Register a simple class loader for PSR-0 test classes.
|
||||
simpletest_classloader_register();
|
||||
|
||||
// Load test information from cache if available, otherwise retrieve the
|
||||
// information from each tests getInfo() method.
|
||||
if ($cache = cache_get('simpletest', 'cache')) {
|
||||
@@ -318,6 +325,34 @@ function simpletest_test_get_all() {
|
||||
// Select all clases in files ending with .test.
|
||||
$classes = db_query("SELECT name FROM {registry} WHERE type = :type AND filename LIKE :name", array(':type' => 'class', ':name' => '%.test'))->fetchCol();
|
||||
|
||||
// Also discover PSR-0 test classes, if the PHP version allows it.
|
||||
if (version_compare(PHP_VERSION, '5.3') > 0) {
|
||||
|
||||
// Select all PSR-0 classes in the Tests namespace of all modules.
|
||||
$system_list = db_query("SELECT name, filename FROM {system}")->fetchAllKeyed();
|
||||
|
||||
foreach ($system_list as $name => $filename) {
|
||||
// Build directory in which the test files would reside.
|
||||
$tests_dir = DRUPAL_ROOT . '/' . dirname($filename) . '/lib/Drupal/' . $name . '/Tests';
|
||||
// Scan it for test files if it exists.
|
||||
if (is_dir($tests_dir)) {
|
||||
$files = file_scan_directory($tests_dir, '/.*\.php/');
|
||||
if (!empty($files)) {
|
||||
$basedir = DRUPAL_ROOT . '/' . dirname($filename) . '/lib/';
|
||||
foreach ($files as $file) {
|
||||
// Convert the file name into the namespaced class name.
|
||||
$replacements = array(
|
||||
'/' => '\\',
|
||||
$basedir => '',
|
||||
'.php' => '',
|
||||
);
|
||||
$classes[] = strtr($file->uri, $replacements);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check that each class has a getInfo() method and store the information
|
||||
// in an array keyed with the group specified in the test information.
|
||||
$groups = array();
|
||||
@@ -353,6 +388,78 @@ function simpletest_test_get_all() {
|
||||
return $groups;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register a simple class loader that can find D8-style PSR-0 test classes.
|
||||
*
|
||||
* Other PSR-0 class loading can happen in contrib, but those contrib class
|
||||
* loader modules will not be enabled when testbot runs. So we need to do this
|
||||
* one in core.
|
||||
*/
|
||||
function simpletest_classloader_register() {
|
||||
|
||||
// Prevent duplicate classloader registration.
|
||||
static $first_run = TRUE;
|
||||
if (!$first_run) {
|
||||
return;
|
||||
}
|
||||
$first_run = FALSE;
|
||||
|
||||
// Only register PSR-0 class loading if we are on PHP 5.3 or higher.
|
||||
if (version_compare(PHP_VERSION, '5.3') > 0) {
|
||||
spl_autoload_register('_simpletest_autoload_psr0');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Autoload callback to find PSR-0 test classes.
|
||||
*
|
||||
* This will only work on classes where the namespace is of the pattern
|
||||
* "Drupal\$extension\Tests\.."
|
||||
*/
|
||||
function _simpletest_autoload_psr0($class) {
|
||||
|
||||
// Static cache for extension paths.
|
||||
// This cache is lazily filled as soon as it is needed.
|
||||
static $extensions;
|
||||
|
||||
// Check that the first namespace fragment is "Drupal\"
|
||||
if (substr($class, 0, 7) === 'Drupal\\') {
|
||||
// Find the position of the second namespace separator.
|
||||
$pos = strpos($class, '\\', 7);
|
||||
// Check that the third namespace fragment is "\Tests\".
|
||||
if (substr($class, $pos, 7) === '\\Tests\\') {
|
||||
|
||||
// Extract the second namespace fragment, which we expect to be the
|
||||
// extension name.
|
||||
$extension = substr($class, 7, $pos - 7);
|
||||
|
||||
// Lazy-load the extension paths, both enabled and disabled.
|
||||
if (!isset($extensions)) {
|
||||
$extensions = db_query("SELECT name, filename FROM {system}")->fetchAllKeyed();
|
||||
}
|
||||
|
||||
// Check if the second namespace fragment is a known extension name.
|
||||
if (isset($extensions[$extension])) {
|
||||
|
||||
// Split the class into namespace and classname.
|
||||
$nspos = strrpos($class, '\\');
|
||||
$namespace = substr($class, 0, $nspos);
|
||||
$classname = substr($class, $nspos + 1);
|
||||
|
||||
// Build the filepath where we expect the class to be defined.
|
||||
$path = dirname($extensions[$extension]) . '/lib/' .
|
||||
str_replace('\\', '/', $namespace) . '/' .
|
||||
str_replace('_', '/', $classname) . '.php';
|
||||
|
||||
// Include the file, if it does exist.
|
||||
if (file_exists($path)) {
|
||||
include $path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_registry_files_alter().
|
||||
*
|
||||
|
@@ -181,6 +181,7 @@ function theme_simpletest_test_table($variables) {
|
||||
* Run selected tests.
|
||||
*/
|
||||
function simpletest_test_form_submit($form, &$form_state) {
|
||||
simpletest_classloader_register();
|
||||
// Get list of tests.
|
||||
$tests_list = array();
|
||||
foreach ($form_state['values'] as $class_name => $value) {
|
||||
@@ -233,6 +234,8 @@ function simpletest_result_form($form, &$form_state, $test_id) {
|
||||
'#debug' => 0,
|
||||
);
|
||||
|
||||
simpletest_classloader_register();
|
||||
|
||||
// Cycle through each test group.
|
||||
$header = array(t('Message'), t('Group'), t('Filename'), t('Line'), t('Function'), array('colspan' => 2, 'data' => t('Status')));
|
||||
$form['result']['results'] = array();
|
||||
|
@@ -45,9 +45,9 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
|
||||
global $conf;
|
||||
if (!$this->inCURL()) {
|
||||
$this->drupalGet('node');
|
||||
$this->assertTrue($this->drupalGetHeader('Date'), t('An HTTP header was received.'));
|
||||
$this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), t('Site title matches.'));
|
||||
$this->assertNoTitle('Foo', t('Site title does not match.'));
|
||||
$this->assertTrue($this->drupalGetHeader('Date'), 'An HTTP header was received.');
|
||||
$this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), 'Site title matches.');
|
||||
$this->assertNoTitle('Foo', 'Site title does not match.');
|
||||
// Make sure that we are locked out of the installer when prefixing
|
||||
// using the user-agent header. This is an important security check.
|
||||
global $base_url;
|
||||
@@ -58,12 +58,12 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
|
||||
$user = $this->drupalCreateUser();
|
||||
$this->drupalLogin($user);
|
||||
$headers = $this->drupalGetHeaders(TRUE);
|
||||
$this->assertEqual(count($headers), 2, t('There was one intermediate request.'));
|
||||
$this->assertTrue(strpos($headers[0][':status'], '302') !== FALSE, t('Intermediate response code was 302.'));
|
||||
$this->assertFalse(empty($headers[0]['location']), t('Intermediate request contained a Location header.'));
|
||||
$this->assertEqual($this->getUrl(), $headers[0]['location'], t('HTTP redirect was followed'));
|
||||
$this->assertFalse($this->drupalGetHeader('Location'), t('Headers from intermediate request were reset.'));
|
||||
$this->assertResponse(200, t('Response code from intermediate request was reset.'));
|
||||
$this->assertEqual(count($headers), 2, 'There was one intermediate request.');
|
||||
$this->assertTrue(strpos($headers[0][':status'], '302') !== FALSE, 'Intermediate response code was 302.');
|
||||
$this->assertFalse(empty($headers[0]['location']), 'Intermediate request contained a Location header.');
|
||||
$this->assertEqual($this->getUrl(), $headers[0]['location'], 'HTTP redirect was followed');
|
||||
$this->assertFalse($this->drupalGetHeader('Location'), 'Headers from intermediate request were reset.');
|
||||
$this->assertResponse(200, 'Response code from intermediate request was reset.');
|
||||
|
||||
// Test the maximum redirection option.
|
||||
$this->drupalLogout();
|
||||
@@ -74,7 +74,7 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
|
||||
variable_set('simpletest_maximum_redirects', 1);
|
||||
$this->drupalPost('user?destination=user/logout', $edit, t('Log in'));
|
||||
$headers = $this->drupalGetHeaders(TRUE);
|
||||
$this->assertEqual(count($headers), 2, t('Simpletest stopped following redirects after the first one.'));
|
||||
$this->assertEqual(count($headers), 2, 'Simpletest stopped following redirects after the first one.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,30 +88,30 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
|
||||
$HTTP_path = $simpletest_path .'/tests/http.php?q=node';
|
||||
$https_path = $simpletest_path .'/tests/https.php?q=node';
|
||||
// Generate a valid simpletest User-Agent to pass validation.
|
||||
$this->assertTrue(preg_match('/simpletest\d+/', $this->databasePrefix, $matches), t('Database prefix contains simpletest prefix.'));
|
||||
$this->assertTrue(preg_match('/simpletest\d+/', $this->databasePrefix, $matches), 'Database prefix contains simpletest prefix.');
|
||||
$test_ua = drupal_generate_test_ua($matches[0]);
|
||||
$this->additionalCurlOptions = array(CURLOPT_USERAGENT => $test_ua);
|
||||
|
||||
// Test pages only available for testing.
|
||||
$this->drupalGet($HTTP_path);
|
||||
$this->assertResponse(200, t('Requesting http.php with a legitimate simpletest User-Agent returns OK.'));
|
||||
$this->assertResponse(200, 'Requesting http.php with a legitimate simpletest User-Agent returns OK.');
|
||||
$this->drupalGet($https_path);
|
||||
$this->assertResponse(200, t('Requesting https.php with a legitimate simpletest User-Agent returns OK.'));
|
||||
$this->assertResponse(200, 'Requesting https.php with a legitimate simpletest User-Agent returns OK.');
|
||||
|
||||
// Now slightly modify the HMAC on the header, which should not validate.
|
||||
$this->additionalCurlOptions = array(CURLOPT_USERAGENT => $test_ua . 'X');
|
||||
$this->drupalGet($HTTP_path);
|
||||
$this->assertResponse(403, t('Requesting http.php with a bad simpletest User-Agent fails.'));
|
||||
$this->assertResponse(403, 'Requesting http.php with a bad simpletest User-Agent fails.');
|
||||
$this->drupalGet($https_path);
|
||||
$this->assertResponse(403, t('Requesting https.php with a bad simpletest User-Agent fails.'));
|
||||
$this->assertResponse(403, 'Requesting https.php with a bad simpletest User-Agent fails.');
|
||||
|
||||
// Use a real User-Agent and verify that the special files http.php and
|
||||
// https.php can't be accessed.
|
||||
$this->additionalCurlOptions = array(CURLOPT_USERAGENT => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12');
|
||||
$this->drupalGet($HTTP_path);
|
||||
$this->assertResponse(403, t('Requesting http.php with a normal User-Agent fails.'));
|
||||
$this->assertResponse(403, 'Requesting http.php with a normal User-Agent fails.');
|
||||
$this->drupalGet($https_path);
|
||||
$this->assertResponse(403, t('Requesting https.php with a normal User-Agent fails.'));
|
||||
$this->assertResponse(403, 'Requesting https.php with a normal User-Agent fails.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
|
||||
|
||||
// Regression test for #290316.
|
||||
// Check that test_id is incrementing.
|
||||
$this->assertTrue($this->test_ids[0] != $this->test_ids[1], t('Test ID is incrementing.'));
|
||||
$this->assertTrue($this->test_ids[0] != $this->test_ids[1], 'Test ID is incrementing.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
|
||||
$this->assertEqual('6 passes, 5 fails, 2 exceptions, and 1 debug message', $this->childTestResults['summary'], 'Stub test summary is correct');
|
||||
|
||||
$this->test_ids[] = $test_id = $this->getTestIdFromResults();
|
||||
$this->assertTrue($test_id, t('Found test ID in results.'));
|
||||
$this->assertTrue($test_id, 'Found test ID in results.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,7 +249,7 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $this->assertTrue($found, t('Found assertion {"@message", "@type", "@status", "@file", "@function"}.', array('@message' => $message, '@type' => $type, '@status' => $status, "@file" => $file, "@function" => $function)));
|
||||
return $this->assertTrue($found, format_string('Found assertion {"@message", "@type", "@status", "@file", "@function"}.', array('@message' => $message, '@type' => $type, '@status' => $status, "@file" => $file, "@function" => $function)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,18 +345,18 @@ class SimpleTestBrowserTestCase extends DrupalWebTestCase {
|
||||
|
||||
$this->drupalGet($url);
|
||||
$absolute = url($url, array('absolute' => TRUE));
|
||||
$this->assertEqual($absolute, $this->url, t('Passed and requested URL are equal.'));
|
||||
$this->assertEqual($this->url, $this->getAbsoluteUrl($this->url), t('Requested and returned absolute URL are equal.'));
|
||||
$this->assertEqual($absolute, $this->url, 'Passed and requested URL are equal.');
|
||||
$this->assertEqual($this->url, $this->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.');
|
||||
|
||||
$this->drupalPost(NULL, array(), t('Log in'));
|
||||
$this->assertEqual($absolute, $this->url, t('Passed and requested URL are equal.'));
|
||||
$this->assertEqual($this->url, $this->getAbsoluteUrl($this->url), t('Requested and returned absolute URL are equal.'));
|
||||
$this->assertEqual($absolute, $this->url, 'Passed and requested URL are equal.');
|
||||
$this->assertEqual($this->url, $this->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.');
|
||||
|
||||
$this->clickLink('Create new account');
|
||||
$url = 'user/register';
|
||||
$absolute = url($url, array('absolute' => TRUE));
|
||||
$this->assertEqual($absolute, $this->url, t('Passed and requested URL are equal.'));
|
||||
$this->assertEqual($this->url, $this->getAbsoluteUrl($this->url), t('Requested and returned absolute URL are equal.'));
|
||||
$this->assertEqual($absolute, $this->url, 'Passed and requested URL are equal.');
|
||||
$this->assertEqual($this->url, $this->getAbsoluteUrl($this->url), 'Requested and returned absolute URL are equal.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -411,19 +411,19 @@ class SimpleTestMailCaptureTestCase extends DrupalWebTestCase {
|
||||
|
||||
// Before we send the e-mail, drupalGetMails should return an empty array.
|
||||
$captured_emails = $this->drupalGetMails();
|
||||
$this->assertEqual(count($captured_emails), 0, t('The captured e-mails queue is empty.'), t('E-mail'));
|
||||
$this->assertEqual(count($captured_emails), 0, 'The captured e-mails queue is empty.', 'E-mail');
|
||||
|
||||
// Send the e-mail.
|
||||
$response = drupal_mail_system('simpletest', 'drupal_mail_test')->mail($message);
|
||||
|
||||
// Ensure that there is one e-mail in the captured e-mails array.
|
||||
$captured_emails = $this->drupalGetMails();
|
||||
$this->assertEqual(count($captured_emails), 1, t('One e-mail was captured.'), t('E-mail'));
|
||||
$this->assertEqual(count($captured_emails), 1, 'One e-mail was captured.', 'E-mail');
|
||||
|
||||
// Assert that the e-mail was sent by iterating over the message properties
|
||||
// and ensuring that they are captured intact.
|
||||
foreach ($message as $field => $value) {
|
||||
$this->assertMail($field, $value, t('The e-mail was sent and the value for property @field is intact.', array('@field' => $field)), t('E-mail'));
|
||||
$this->assertMail($field, $value, format_string('The e-mail was sent and the value for property @field is intact.', array('@field' => $field)), 'E-mail');
|
||||
}
|
||||
|
||||
// Send additional e-mails so more than one e-mail is captured.
|
||||
@@ -440,21 +440,21 @@ class SimpleTestMailCaptureTestCase extends DrupalWebTestCase {
|
||||
|
||||
// There should now be 6 e-mails captured.
|
||||
$captured_emails = $this->drupalGetMails();
|
||||
$this->assertEqual(count($captured_emails), 6, t('All e-mails were captured.'), t('E-mail'));
|
||||
$this->assertEqual(count($captured_emails), 6, 'All e-mails were captured.', 'E-mail');
|
||||
|
||||
// Test different ways of getting filtered e-mails via drupalGetMails().
|
||||
$captured_emails = $this->drupalGetMails(array('id' => 'drupal_mail_test'));
|
||||
$this->assertEqual(count($captured_emails), 1, t('Only one e-mail is returned when filtering by id.'), t('E-mail'));
|
||||
$this->assertEqual(count($captured_emails), 1, 'Only one e-mail is returned when filtering by id.', 'E-mail');
|
||||
$captured_emails = $this->drupalGetMails(array('id' => 'drupal_mail_test', 'subject' => $subject));
|
||||
$this->assertEqual(count($captured_emails), 1, t('Only one e-mail is returned when filtering by id and subject.'), t('E-mail'));
|
||||
$this->assertEqual(count($captured_emails), 1, 'Only one e-mail is returned when filtering by id and subject.', 'E-mail');
|
||||
$captured_emails = $this->drupalGetMails(array('id' => 'drupal_mail_test', 'subject' => $subject, 'from' => 'this_was_not_used@example.com'));
|
||||
$this->assertEqual(count($captured_emails), 0, t('No e-mails are returned when querying with an unused from address.'), t('E-mail'));
|
||||
$this->assertEqual(count($captured_emails), 0, 'No e-mails are returned when querying with an unused from address.', 'E-mail');
|
||||
|
||||
// Send the last e-mail again, so we can confirm that the drupalGetMails-filter
|
||||
// correctly returns all e-mails with a given property/value.
|
||||
drupal_mail_system('drupal_mail_test', $index)->mail($message);
|
||||
$captured_emails = $this->drupalGetMails(array('id' => 'drupal_mail_test_4'));
|
||||
$this->assertEqual(count($captured_emails), 2, t('All e-mails with the same id are returned when filtering by id.'), t('E-mail'));
|
||||
$this->assertEqual(count($captured_emails), 2, 'All e-mails with the same id are returned when filtering by id.', 'E-mail');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ class SimpleTestFolderTestCase extends DrupalWebTestCase {
|
||||
|
||||
function testFolderSetup() {
|
||||
$directory = file_default_scheme() . '://styles';
|
||||
$this->assertTrue(file_prepare_directory($directory, FALSE), "Directory created.");
|
||||
$this->assertTrue(file_prepare_directory($directory, FALSE), 'Directory created.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -655,3 +655,92 @@ class SimpleTestOtherInstallationProfileModuleTestsTestCase extends DrupalWebTes
|
||||
$this->assertNoText('Installation profile module tests helper');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that tests in other installation profiles are not found.
|
||||
*
|
||||
* @see SimpleTestInstallationProfileModuleTestsTestCase
|
||||
*/
|
||||
class SimpleTestDiscoveryTestCase extends DrupalWebTestCase {
|
||||
/**
|
||||
* Use the Testing profile.
|
||||
*
|
||||
* The Testing profile contains drupal_system_listing_compatible_test.test,
|
||||
* which attempts to:
|
||||
* - run tests using the Minimal profile (which does not contain the
|
||||
* drupal_system_listing_compatible_test.module)
|
||||
* - but still install the drupal_system_listing_compatible_test.module
|
||||
* contained in the Testing profile.
|
||||
*
|
||||
* @see DrupalSystemListingCompatibleTestCase
|
||||
*/
|
||||
protected $profile = 'testing';
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Discovery of test classes',
|
||||
'description' => 'Verifies that tests classes are discovered and can be autoloaded (class_exists).',
|
||||
'group' => 'SimpleTest',
|
||||
);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp(array('simpletest'));
|
||||
|
||||
$this->admin_user = $this->drupalCreateUser(array('administer unit tests'));
|
||||
$this->drupalLogin($this->admin_user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test discovery of PSR-0 test classes.
|
||||
*/
|
||||
function testDiscoveryFunctions() {
|
||||
if (version_compare(PHP_VERSION, '5.3') < 0) {
|
||||
// Don't expect PSR-0 tests to be discovered on older PHP versions.
|
||||
return;
|
||||
}
|
||||
// TODO: What if we have cached values? Do we need to force a cache refresh?
|
||||
$classes_all = simpletest_test_get_all();
|
||||
foreach (array(
|
||||
'Drupal\\simpletest\\Tests\\PSR0WebTest',
|
||||
'Drupal\\psr_0_test\\Tests\\ExampleTest',
|
||||
) as $class) {
|
||||
$this->assert(!empty($classes_all['SimpleTest'][$class]), t('Class @class must be discovered by simpletest_test_get_all().', array('@class' => $class)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests existence of test cases.
|
||||
*/
|
||||
function testDiscovery() {
|
||||
$this->drupalGet('admin/config/development/testing');
|
||||
// Tests within enabled modules.
|
||||
// (without these, this test wouldn't happen in the first place, so this is
|
||||
// a bit pointless. We still run it for proof-of-concept.)
|
||||
// This one is defined in system module.
|
||||
$this->assertText('Drupal error handlers');
|
||||
// This one is defined in simpletest module.
|
||||
$this->assertText('Discovery of test classes');
|
||||
// Tests within disabled modules.
|
||||
if (version_compare(PHP_VERSION, '5.3') < 0) {
|
||||
// Don't expect PSR-0 tests to be discovered on older PHP versions.
|
||||
return;
|
||||
}
|
||||
// This one is provided by simpletest itself via PSR-0.
|
||||
$this->assertText('PSR0 web test');
|
||||
$this->assertText('PSR0 example test: PSR-0 in disabled modules.');
|
||||
$this->assertText('PSR0 example test: PSR-0 in nested subfolders.');
|
||||
|
||||
// Test each test individually.
|
||||
foreach (array(
|
||||
'Drupal\\psr_0_test\\Tests\\ExampleTest',
|
||||
'Drupal\\psr_0_test\\Tests\\Nested\\NestedExampleTest',
|
||||
) as $class) {
|
||||
$this->drupalGet('admin/config/development/testing');
|
||||
$edit = array($class => TRUE);
|
||||
$this->drupalPost(NULL, $edit, t('Run tests'));
|
||||
$this->assertText('The test run finished', t('Test @class must finish.', array('@class' => $class)));
|
||||
$this->assertText('1 pass, 0 fails, and 0 exceptions', t('Test @class must pass.', array('@class' => $class)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -2298,6 +2298,12 @@ class FormatDateUnitTest extends DrupalWebTestCase {
|
||||
$edit = array('date_format' => $admin_date_format);
|
||||
$this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
|
||||
|
||||
// Add a new date format which just differs in the case.
|
||||
$admin_date_format_uppercase = 'j M Y';
|
||||
$edit = array('date_format' => $admin_date_format_uppercase);
|
||||
$this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
|
||||
$this->assertText(t('Custom date format added.'));
|
||||
|
||||
// Add new date type.
|
||||
$edit = array(
|
||||
'date_type' => 'Example Style',
|
||||
@@ -2306,8 +2312,18 @@ class FormatDateUnitTest extends DrupalWebTestCase {
|
||||
);
|
||||
$this->drupalPost('admin/config/regional/date-time/types/add', $edit, t('Add date type'));
|
||||
|
||||
// Add a second date format with a different case than the first.
|
||||
$edit = array(
|
||||
'machine_name' => 'example_style_uppercase',
|
||||
'date_type' => 'Example Style Uppercase',
|
||||
'date_format' => $admin_date_format_uppercase,
|
||||
);
|
||||
$this->drupalPost('admin/config/regional/date-time/types/add', $edit, t('Add date type'));
|
||||
$this->assertText(t('New date type added successfully.'));
|
||||
|
||||
$timestamp = strtotime('2007-03-10T00:00:00+00:00');
|
||||
$this->assertIdentical(format_date($timestamp, 'example_style', '', 'America/Los_Angeles'), '9 Mar 07', t('Test format_date() using an admin-defined date type.'));
|
||||
$this->assertIdentical(format_date($timestamp, 'example_style_uppercase', '', 'America/Los_Angeles'), '9 Mar 2007', 'Test format_date() using an admin-defined date type with different case.');
|
||||
$this->assertIdentical(format_date($timestamp, 'undefined_style'), format_date($timestamp, 'medium'), t('Test format_date() defaulting to medium when $type not found.'));
|
||||
}
|
||||
|
||||
@@ -2499,10 +2515,10 @@ class DrupalGetRdfNamespacesTestCase extends DrupalWebTestCase {
|
||||
$xml = new SimpleXMLElement($this->content);
|
||||
$ns = $xml->getDocNamespaces();
|
||||
|
||||
$this->assertEqual($ns['rdfs'], 'http://www.w3.org/2000/01/rdf-schema#', t('A prefix declared once is displayed.'));
|
||||
$this->assertEqual($ns['foaf'], 'http://xmlns.com/foaf/0.1/', t('The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.'));
|
||||
$this->assertEqual($ns['foaf1'], 'http://xmlns.com/foaf/0.1/', t('Two prefixes can be assigned the same namespace.'));
|
||||
$this->assertTrue(!isset($ns['dc']), t('A prefix with conflicting namespaces is discarded.'));
|
||||
$this->assertEqual($ns['rdfs'], 'http://www.w3.org/2000/01/rdf-schema#', 'A prefix declared once is displayed.');
|
||||
$this->assertEqual($ns['foaf'], 'http://xmlns.com/foaf/0.1/', 'The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.');
|
||||
$this->assertEqual($ns['foaf1'], 'http://xmlns.com/foaf/0.1/', 'Two prefixes can be assigned the same namespace.');
|
||||
$this->assertTrue(!isset($ns['dc']), 'A prefix with conflicting namespaces is discarded.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -7,8 +7,8 @@ stylesheets[all][] = common_test.css
|
||||
stylesheets[print][] = common_test.print.css
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
dependencies[] = entity_cache_test_dependency
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -2578,6 +2578,15 @@ class FileNameMungingTest extends FileTestCase {
|
||||
$this->assertNotEqual($munged_name, $this->name, t('The new filename (%munged) has been modified from the original (%original)', array('%munged' => $munged_name, '%original' => $this->name)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests munging with a null byte in the filename.
|
||||
*/
|
||||
function testMungeNullByte() {
|
||||
$prefix = $this->randomName();
|
||||
$filename = $prefix . '.' . $this->bad_extension . "\0.txt";
|
||||
$this->assertEqual(file_munge_filename($filename, ''), $prefix . '.' . $this->bad_extension . '_.txt', 'A filename with a null byte is correctly munged to remove the null byte.');
|
||||
}
|
||||
|
||||
/**
|
||||
* If the allow_insecure_uploads variable evaluates to true, the file should
|
||||
* come out untouched, no matter how evil the filename.
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = file_test.module
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -657,6 +657,17 @@ class FormValidationTestCase extends DrupalWebTestCase {
|
||||
$this->assertText(t('!name field is required.', array('!name' => 'Title')));
|
||||
$this->assertText('Test element is invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests error border of multiple fields with same name in a page.
|
||||
*/
|
||||
function testMultiFormSameNameErrorClass() {
|
||||
$this->drupalGet('form-test/double-form');
|
||||
$edit = array();
|
||||
$this->drupalPost(NULL, $edit, t('Save'));
|
||||
$this->assertFieldByXpath('//input[@id="edit-name" and contains(@class, "error")]', NULL, 'Error input form element class found for first element.');
|
||||
$this->assertNoFieldByXpath('//input[@id="edit-name--2" and contains(@class, "error")]', NULL, 'No error input form element class found for second element.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\psr_0_test\Tests;
|
||||
|
||||
class ExampleTest extends \DrupalWebTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'PSR0 example test: PSR-0 in disabled modules.',
|
||||
'description' => 'We want to assert that this test case is being discovered.',
|
||||
'group' => 'SimpleTest',
|
||||
);
|
||||
}
|
||||
|
||||
function testArithmetics() {
|
||||
$this->assert(1 + 1 == 2, '1 + 1 == 2');
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\psr_0_test\Tests\Nested;
|
||||
|
||||
class NestedExampleTest extends \DrupalWebTestCase {
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'PSR0 example test: PSR-0 in nested subfolders.',
|
||||
'description' => 'We want to assert that this PSR-0 test case is being discovered.',
|
||||
'group' => 'SimpleTest',
|
||||
);
|
||||
}
|
||||
|
||||
function testArithmetics() {
|
||||
$this->assert(1 + 1 == 2, '1 + 1 == 2');
|
||||
}
|
||||
}
|
12
modules/simpletest/tests/psr_0_test/psr_0_test.info
Normal file
12
modules/simpletest/tests/psr_0_test/psr_0_test.info
Normal file
@@ -0,0 +1,12 @@
|
||||
name = PSR-0 Test cases
|
||||
description = Test classes to be discovered by simpletest.
|
||||
core = 7.x
|
||||
|
||||
hidden = TRUE
|
||||
package = Testing
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1365027012"
|
||||
|
1
modules/simpletest/tests/psr_0_test/psr_0_test.module
Normal file
1
modules/simpletest/tests/psr_0_test/psr_0_test.module
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -7,8 +7,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
hidden = TRUE
|
||||
dependencies[] = _missing_dependency
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
hidden = TRUE
|
||||
dependencies[] = system_incompatible_core_version_test
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 5.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -7,8 +7,8 @@ hidden = TRUE
|
||||
; system_incompatible_module_version_test declares version 1.0
|
||||
dependencies[] = system_incompatible_module_version_test (>2.0)
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = 1.0
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = system_test.module
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ core = 7.x
|
||||
hidden = TRUE
|
||||
dependencies[] = taxonomy
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ hidden = TRUE
|
||||
settings[basetheme_only] = base theme value
|
||||
settings[subtheme_override] = base theme value
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -6,8 +6,8 @@ hidden = TRUE
|
||||
|
||||
settings[subtheme_override] = subtheme value
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -17,8 +17,8 @@ stylesheets[all][] = system.base.css
|
||||
|
||||
settings[theme_test_setting] = default value
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
// Simulate duplicated permission condition.
|
||||
db_update('permission')->fields(array(
|
||||
'perm' => 'access content, access content',
|
||||
))
|
||||
->condition('pid', 1)
|
||||
->execute();
|
@@ -566,6 +566,20 @@ class BasicMinimalUpdatePath extends UpdatePathTestCase {
|
||||
// Confirm that no {menu_links} entry exists for user/autocomplete.
|
||||
$result = db_query('SELECT COUNT(*) FROM {menu_links} WHERE link_path = :user_autocomplete', array(':user_autocomplete' => 'user/autocomplete'))->fetchField();
|
||||
$this->assertFalse($result, t('No {menu_links} entry exists for user/autocomplete'));
|
||||
|
||||
// Confirm that a date format that just differs in the case can be added.
|
||||
$admin_date_format = 'j M y';
|
||||
$edit = array('date_format' => $admin_date_format);
|
||||
$this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
|
||||
|
||||
// Add a new date format which just differs in the case.
|
||||
$admin_date_format_uppercase = 'j M Y';
|
||||
$edit = array('date_format' => $admin_date_format_uppercase);
|
||||
$this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
|
||||
$this->assertText(t('Custom date format added.'));
|
||||
|
||||
// Verify that the unique key on {date_formats}.format still exists.
|
||||
$this->assertTrue(db_index_exists('date_formats', 'formats'), 'Unique key on {date_formats} exists');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -61,3 +61,32 @@ class UserUpgradePathNoPasswordTokenTestCase extends UpgradePathTestCase {
|
||||
$this->assertEqual(variable_get('user_mail_register_no_approval_required_body'), '[user:name], [site:name], [site:url], [site:url-brief], [user:mail], [date:medium], [site:login-url], [user:edit-url], [user:one-time-login-url].', 'Existing email templates have been modified (password token not involved).');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade test for user.module (duplicated permission).
|
||||
*/
|
||||
class UserUpgradePathDuplicatedPermissionTestCase extends UpgradePathTestCase {
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'User upgrade path (duplicated permission)',
|
||||
'description' => 'User upgrade path tests (duplicated permission).',
|
||||
'group' => 'Upgrade path',
|
||||
);
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
// Path to the database dump files.
|
||||
$this->databaseDumpFiles = array(
|
||||
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.bare.database.php',
|
||||
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.duplicate-permission.database.php',
|
||||
);
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a successful upgrade.
|
||||
*/
|
||||
public function testUserUpgrade() {
|
||||
$this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
|
||||
}
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ package = Testing
|
||||
version = VERSION
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-03-07
|
||||
version = "7.21"
|
||||
; Information added by drupal.org packaging script on 2013-04-03
|
||||
version = "7.22"
|
||||
project = "drupal"
|
||||
datestamp = "1362616996"
|
||||
datestamp = "1365027012"
|
||||
|
||||
|
Reference in New Issue
Block a user