Commit 87417aaf authored by jhodgdon's avatar jhodgdon

Issue #2028939 by cilefen, deekayen: Clean up line wrapping in simpletest...

Issue #2028939 by cilefen, deekayen: Clean up line wrapping in simpletest documentation and make namespaces in docs fully qualified
parent 09d7b819
......@@ -2,7 +2,7 @@
/**
* @file
* Contains Drupal\simpletest\DrupalUnitTestBase.
* Contains \Drupal\simpletest\DrupalUnitTestBase.
*/
namespace Drupal\simpletest;
......
......@@ -95,7 +95,8 @@ public function getFormID() {
* {@inheritdoc}
*/
public function buildForm(array $form, array &$form_state, $test_id = NULL) {
// Make sure there are test results to display and a re-run is not being performed.
// Make sure there are test results to display and a re-run is not being
// performed.
$results = array();
if (is_numeric($test_id) && !$results = $this->getResults($test_id)) {
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\simpletest\TestBase.
* Definition of \Drupal\simpletest\TestBase.
*/
namespace Drupal\simpletest;
......@@ -23,8 +23,8 @@
/**
* Base class for Drupal tests.
*
* Do not extend this class directly, use either Drupal\simpletest\WebTestBaseBase
* or Drupal\simpletest\UnitTestBaseBase.
* Do not extend this class directly, use either
* \Drupal\simpletest\WebTestBaseBase or \Drupal\simpletest\UnitTestBaseBase.
*/
abstract class TestBase {
/**
......@@ -273,14 +273,14 @@ protected function assert($status, $message = '', $group = 'Other', array $calle
* the test case has been destroyed, such as PHP fatal errors. The caller
* information is not automatically gathered since the caller is most likely
* inserting the assertion on behalf of other code. In all other respects
* the method behaves just like Drupal\simpletest\TestBase::assert() in terms
* the method behaves just like \Drupal\simpletest\TestBase::assert() in terms
* of storing the assertion.
*
* @return
* Message ID of the stored assertion.
*
* @see Drupal\simpletest\TestBase::assert()
* @see Drupal\simpletest\TestBase::deleteAssert()
* @see \Drupal\simpletest\TestBase::assert()
* @see \Drupal\simpletest\TestBase::deleteAssert()
*/
public static function insertAssert($test_id, $test_class, $status, $message = '', $group = 'Other', array $caller = array()) {
// Convert boolean status to string status.
......@@ -319,7 +319,7 @@ public static function insertAssert($test_id, $test_class, $status, $message = '
* @return
* TRUE if the assertion was deleted, FALSE otherwise.
*
* @see Drupal\simpletest\TestBase::insertAssert()
* @see \Drupal\simpletest\TestBase::insertAssert()
*/
public static function deleteAssert($message_id) {
return (bool) self::getDatabaseConnection()
......@@ -331,7 +331,7 @@ public static function deleteAssert($message_id) {
/**
* Returns the database connection to the site running Simpletest.
*
* @return Drupal\Core\Database\Connection
* @return \Drupal\Core\Database\Connection
* The database connection to use for inserting assertions.
*/
public static function getDatabaseConnection() {
......@@ -369,7 +369,9 @@ protected function getAssertionCall() {
}
/**
* Check to see if a value is not false (not an empty string, 0, NULL, or FALSE).
* Check to see if a value is not false.
*
* False values are: empty string, 0, NULL, and FALSE.
*
* @param $value
* The value on which the assertion is to be done.
......@@ -390,7 +392,9 @@ protected function assertTrue($value, $message = '', $group = 'Other') {
}
/**
* Check to see if a value is false (an empty string, 0, NULL, or FALSE).
* Check to see if a value is false.
*
* False values are: empty string, 0, NULL, and FALSE.
*
* @param $value
* The value on which the assertion is to be done.
......@@ -989,7 +993,7 @@ protected function rebuildContainer() {
}
/**
* Deletes created files, database tables, and reverts all environment changes.
* Deletes created files, database tables, and reverts environment changes.
*
* This method needs to be invoked for both unit and integration tests.
*
......@@ -1128,7 +1132,8 @@ protected function exceptionHandler($exception) {
'line' => $exception->getLine(),
'file' => $exception->getFile(),
));
// The exception message is run through check_plain() by _drupal_decode_exception().
// The exception message is run through check_plain()
// by _drupal_decode_exception().
$decoded_exception = _drupal_decode_exception($exception);
unset($decoded_exception['backtrace']);
$message = format_string('%type: !message in %function (line %line of %file). <pre class="backtrace">!backtrace</pre>', $decoded_exception + array(
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\simpletest\Tests\BrokenSetUpTest.
* Definition of \Drupal\simpletest\Tests\BrokenSetUpTest.
*/
namespace Drupal\simpletest\Tests;
......@@ -13,11 +13,11 @@
* Tests a test case that does not run parent::setUp() in its setUp() method.
*
* If a test case does not call parent::setUp(), running
* Drupal\simpletest\WebTestBase::tearDown() would destroy the main site's
* \Drupal\simpletest\WebTestBase::tearDown() would destroy the main site's
* database tables. Therefore, we ensure that tests which are not set up
* properly are skipped.
*
* @see Drupal\simpletest\WebTestBase
* @see \Drupal\simpletest\WebTestBase
*/
class BrokenSetUpTest extends WebTestBase {
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\simpletest\Tests\BrowserTest.
* Definition of \Drupal\simpletest\Tests\BrowserTest.
*/
namespace Drupal\simpletest\Tests;
......@@ -22,7 +22,7 @@ public static function getInfo() {
}
/**
* Test Drupal\simpletest\WebTestBase::getAbsoluteUrl().
* Test \Drupal\simpletest\WebTestBase::getAbsoluteUrl().
*/
function testGetAbsoluteUrl() {
$url = 'user/login';
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains Drupal\simpletest\Tests\DrupalUnitTestBaseTest.
* Contains \Drupal\simpletest\Tests\DrupalUnitTestBaseTest.
*/
namespace Drupal\simpletest\Tests;
......@@ -104,7 +104,7 @@ function testEnableModulesInstall() {
}
/**
* Tests installing modules via enableModules() with DepedencyInjection services.
* Tests installing modules with DependencyInjection services.
*/
function testEnableModulesInstallContainer() {
// Install Node module.
......@@ -195,7 +195,7 @@ function testInstallConfig() {
}
/**
* Tests that the module list is retained after enabling/installing/disabling modules.
* Tests that the module list is retained after enabling/installing/disabling.
*/
function testEnableModulesFixedList() {
// entity_test is loaded via $modules; its entity type should exist.
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\simpletest\Tests\FolderTest.
* Definition of \Drupal\simpletest\Tests\FolderTest.
*/
namespace Drupal\simpletest\Tests;
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\simpletest\Tests\InstallationProfileModuleTestsTest.
* Definition of \Drupal\simpletest\Tests\InstallationProfileModuleTestsTest.
*/
namespace Drupal\simpletest\Tests;
......@@ -31,7 +31,7 @@ class InstallationProfileModuleTestsTest extends WebTestBase {
* - but still install the drupal_system_listing_compatible_test.module
* contained in the Testing profile.
*
* @see Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
* @see \Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
*/
protected $profile = 'testing';
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\simpletest\Tests\MailCaptureTest.
* Definition of \Drupal\simpletest\Tests\MailCaptureTest.
*/
namespace Drupal\simpletest\Tests;
......@@ -77,8 +77,9 @@ function testMailSend() {
$captured_emails = $this->drupalGetMails(array('id' => 'drupal_mail_test', 'subject' => $subject, 'from' => 'this_was_not_used@example.com'));
$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.
// 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, 'All e-mails with the same id are returned when filtering by id.', 'E-mail');
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\simpletest\Tests\MissingCheckedRequirementsTest.
* Definition of \Drupal\simpletest\Tests\MissingCheckedRequirementsTest.
*/
namespace Drupal\simpletest\Tests;
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\simpletest\Tests\MissingDependentModuleUnitTest.
* Definition of \Drupal\simpletest\Tests\MissingDependentModuleUnitTest.
*/
namespace Drupal\simpletest\Tests;
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\simpletest\Tests\OtherInstallationProfileModuleTestsTest.
* Definition of \Drupal\simpletest\Tests\OtherInstallationProfileModuleTestsTest.
*/
namespace Drupal\simpletest\Tests;
......@@ -30,7 +30,7 @@ class OtherInstallationProfileModuleTestsTest extends WebTestBase {
* which should not be found.
*
* @see SimpleTestInstallationProfileModuleTestsTestCase
* @see Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
* @see \Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
*/
protected $profile = 'minimal';
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\simpletest\Tests\SimpleTestTest.
* Definition of \Drupal\simpletest\Tests\SimpleTestTest.
*/
namespace Drupal\simpletest\Tests;
......@@ -25,8 +25,9 @@ class SimpleTestTest extends WebTestBase {
protected $childTestResults;
/**
* Store the test ID from each test run for comparison, to ensure they are
* incrementing.
* Stores the test ID from each test run for comparison.
*
* Used to ensure they are incrementing.
*/
protected $test_ids = array();
......@@ -131,8 +132,7 @@ function testUserAgentValidation() {
}
/**
* Make sure that tests selected through the web interface are run and
* that the results are displayed correctly.
* Ensures the tests selected through the web interface are run and displayed.
*/
function testWebTestRunner() {
$this->pass = t('SimpleTest pass.');
......@@ -141,7 +141,8 @@ function testWebTestRunner() {
$this->invalid_permission = 'invalid permission';
if ($this->inCURL()) {
// Only run following code if this test is running itself through a CURL request.
// Only run following code if this test is running itself through a CURL
// request.
$this->stubTest();
}
else {
......@@ -215,9 +216,9 @@ function confirmStubTestResults() {
// Check that the backtracing code works for specific assert function.
$this->assertAssertion('This is nothing.', 'Other', 'Pass', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
// Check that errors that occur inside PHP internal functions are correctly reported.
// The exact error message differs between PHP versions so we check only
// the function name 'array_key_exists'.
// Check that errors that occur inside PHP internal functions are correctly
// reported. The exact error message differs between PHP versions so we
// check only the function name 'array_key_exists'.
$this->assertAssertion('array_key_exists', 'Warning', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
$this->assertAssertion("Debug: 'Foo'", 'Debug', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
......@@ -241,8 +242,7 @@ function getTestIdFromResults() {
}
/**
* Assert that an assertion with the specified values is displayed
* in the test results.
* Asserts that an assertion with specified values is displayed in results.
*
* @param string $message Assertion message.
* @param string $type Assertion type.
......
......@@ -35,10 +35,10 @@ function __construct($test_id = NULL) {
/**
* Sets up unit test environment.
*
* Unlike Drupal\simpletest\WebTestBase::setUp(), UnitTestBase::setUp() does not
* install modules because tests are performed without accessing the database.
* Any required files must be explicitly included by the child class setUp()
* method.
* Unlike \Drupal\simpletest\WebTestBase::setUp(), UnitTestBase::setUp() does
* not install modules because tests are performed without accessing the
* database. Any required files must be explicitly included by the child class
* setUp() method.
*/
protected function setUp() {
global $conf;
......@@ -60,7 +60,7 @@ protected function setUp() {
// Change the database prefix.
// All static variables need to be reset before the database prefix is
// changed, since Drupal\Core\Utility\CacheArray implementations attempt to
// changed, since \Drupal\Core\Utility\CacheArray implementations attempt to
// write back to persistent caches when they are destructed.
$this->changeDatabasePrefix();
if (!$this->setupDatabasePrefix) {
......
......@@ -59,9 +59,10 @@ function hook_test_group_finished() {
* This hook is called when an individual test has finished.
*
* @param
* $results The results of the test as gathered by Drupal\simpletest\WebTestBase.
* $results The results of the test as gathered by
* \Drupal\simpletest\WebTestBase.
*
* @see Drupal\simpletest\WebTestBase->results()
* @see \Drupal\simpletest\WebTestBase->results()
*/
function hook_test_finished($results) {
}
......
......@@ -530,7 +530,7 @@ function simpletest_classloader_register() {
}
}
// Register the core test directory so we can find Drupal\UnitTestCase.
// Register the core test directory so we can find \Drupal\UnitTestCase.
drupal_classloader()->addPrefix('Drupal\\Tests', DRUPAL_ROOT . '/core/tests');
// Manually register phpunit prefixes because they use a classmap instead of a
......@@ -565,7 +565,8 @@ function simpletest_generate_file($filename, $width, $lines, $type = 'binary-tex
break;
}
}
$text = wordwrap($text, $width - 1, "\n", TRUE) . "\n"; // Add \n for symmetrical file.
// Add \n for symmetrical file.
$text = wordwrap($text, $width - 1, "\n", TRUE) . "\n";
// Create filename.
file_put_contents('public://' . $filename . '.txt', $text);
......@@ -591,8 +592,7 @@ function simpletest_clean_environment() {
}
/**
* Removed prefixed tables from the database that are left over from crashed
* tests.
* Remove prefixed tables from the database from crashed tests.
*/
function simpletest_clean_database() {
$tables = db_find_tables(Database::getConnection()->prefixTables('{simpletest}') . '%');
......
......@@ -6,7 +6,7 @@
*/
/**
* Returns HTML for a test list generated by simpletest_test_form() into a table.
* Returns an HTML table for a test list generated by simpletest_test_form().
*
* @param $variables
* An associative array containing:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment