Issue #2080343 by connork, izus, rahul.shinde, lokapujya | mrsinguyen: Remove Unused local variables from system module.
parent
3a42e91de1
commit
d8505d2eb2
|
@ -28,11 +28,10 @@ class ElementValidationTest extends AjaxTestBase {
|
|||
* Ajax-enabled field fails due to the required field being empty.
|
||||
*/
|
||||
function testAjaxElementValidation() {
|
||||
$web_user = $this->drupalCreateUser();
|
||||
$edit = array('drivertext' => t('some dumb text'));
|
||||
|
||||
// Post with 'drivertext' as the triggering element.
|
||||
$post_result = $this->drupalPostAjaxForm('ajax_validation_test', $edit, 'drivertext');
|
||||
$this->drupalPostAjaxForm('ajax_validation_test', $edit, 'drivertext');
|
||||
// Look for a validation failure in the resultant JSON.
|
||||
$this->assertNoText(t('Error message'), 'No error message in resultant JSON');
|
||||
$this->assertText('ajax_forms_test_validation_form_callback invoked', 'The correct callback was invoked');
|
||||
|
@ -41,7 +40,7 @@ class ElementValidationTest extends AjaxTestBase {
|
|||
$edit = array('drivernumber' => 12345);
|
||||
|
||||
// Post with 'drivernumber' as the triggering element.
|
||||
$post_result = $this->drupalPostAjaxForm('ajax_validation_test', $edit, 'drivernumber');
|
||||
$this->drupalPostAjaxForm('ajax_validation_test', $edit, 'drivernumber');
|
||||
// Look for a validation failure in the resultant JSON.
|
||||
$this->assertNoText(t('Error message'), 'No error message in resultant JSON');
|
||||
$this->assertText('ajax_forms_test_validation_number_form_callback invoked', 'The correct callback was invoked');
|
||||
|
|
|
@ -68,7 +68,7 @@ class AddFeedTest extends WebTestBase {
|
|||
|
||||
$html_page = new HtmlPage();
|
||||
|
||||
foreach ($urls as $description => $feed_info) {
|
||||
foreach ($urls as $feed_info) {
|
||||
$feed_link = new FeedLinkElement($feed_info['title'], $feed_info['url']);
|
||||
$html_page->addLinkElement($feed_link);
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class WriteRecordTest extends DrupalUnitTestBase {
|
|||
$person->name = 'Ringo';
|
||||
$person->age = NULL;
|
||||
$person->job = NULL;
|
||||
$insert_result = drupal_write_record('test', $person);
|
||||
drupal_write_record('test', $person);
|
||||
$this->assertTrue(isset($person->id), 'Primary key is set on record created with drupal_write_record().');
|
||||
$result = db_query("SELECT * FROM {test} WHERE id = :id", array(':id' => $person->id))->fetchObject();
|
||||
$this->assertIdentical($result->name, 'Ringo', 'Name field set.');
|
||||
|
@ -86,7 +86,7 @@ class WriteRecordTest extends DrupalUnitTestBase {
|
|||
$person = new \stdClass();
|
||||
$person->name = 'Paul';
|
||||
$person->age = NULL;
|
||||
$insert_result = drupal_write_record('test_null', $person);
|
||||
drupal_write_record('test_null', $person);
|
||||
$this->assertTrue(isset($person->id), 'Primary key is set on record created with drupal_write_record().');
|
||||
$result = db_query("SELECT * FROM {test_null} WHERE id = :id", array(':id' => $person->id))->fetchObject();
|
||||
$this->assertIdentical($result->name, 'Paul', 'Name field set.');
|
||||
|
@ -95,7 +95,7 @@ class WriteRecordTest extends DrupalUnitTestBase {
|
|||
// Insert a record - do not specify the value of a column that allows NULL.
|
||||
$person = new \stdClass();
|
||||
$person->name = 'Meredith';
|
||||
$insert_result = drupal_write_record('test_null', $person);
|
||||
drupal_write_record('test_null', $person);
|
||||
$this->assertTrue(isset($person->id), 'Primary key is set on record created with drupal_write_record().');
|
||||
$this->assertIdentical($person->age, 0, 'Age field set to default value.');
|
||||
$result = db_query("SELECT * FROM {test_null} WHERE id = :id", array(':id' => $person->id))->fetchObject();
|
||||
|
@ -105,7 +105,7 @@ class WriteRecordTest extends DrupalUnitTestBase {
|
|||
// Update the newly created record.
|
||||
$person->name = 'Mary';
|
||||
$person->age = NULL;
|
||||
$update_result = drupal_write_record('test_null', $person, array('id'));
|
||||
drupal_write_record('test_null', $person, array('id'));
|
||||
$result = db_query("SELECT * FROM {test_null} WHERE id = :id", array(':id' => $person->id))->fetchObject();
|
||||
$this->assertIdentical($result->name, 'Mary', 'Name field set.');
|
||||
$this->assertIdentical($result->age, NULL, 'Age field set.');
|
||||
|
@ -113,20 +113,20 @@ class WriteRecordTest extends DrupalUnitTestBase {
|
|||
// Insert a record - the "data" column should be serialized.
|
||||
$person = new \stdClass();
|
||||
$person->name = 'Dave';
|
||||
$update_result = drupal_write_record('test_serialized', $person);
|
||||
drupal_write_record('test_serialized', $person);
|
||||
$result = db_query("SELECT * FROM {test_serialized} WHERE id = :id", array(':id' => $person->id))->fetchObject();
|
||||
$this->assertIdentical($result->name, 'Dave', 'Name field set.');
|
||||
$this->assertIdentical($result->info, NULL, 'Info field set.');
|
||||
|
||||
$person->info = array();
|
||||
$update_result = drupal_write_record('test_serialized', $person, array('id'));
|
||||
drupal_write_record('test_serialized', $person, array('id'));
|
||||
$result = db_query("SELECT * FROM {test_serialized} WHERE id = :id", array(':id' => $person->id))->fetchObject();
|
||||
$this->assertIdentical(unserialize($result->info), array(), 'Info field updated.');
|
||||
|
||||
// Update the serialized record.
|
||||
$data = array('foo' => 'bar', 1 => 2, 'empty' => '', 'null' => NULL);
|
||||
$person->info = $data;
|
||||
$update_result = drupal_write_record('test_serialized', $person, array('id'));
|
||||
drupal_write_record('test_serialized', $person, array('id'));
|
||||
$result = db_query("SELECT * FROM {test_serialized} WHERE id = :id", array(':id' => $person->id))->fetchObject();
|
||||
$this->assertIdentical(unserialize($result->info), $data, 'Info field updated.');
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ abstract class DatabaseTestBase extends DrupalUnitTestBase {
|
|||
))
|
||||
->execute();
|
||||
|
||||
$ringo = db_insert('test')
|
||||
db_insert('test')
|
||||
->fields(array(
|
||||
'name' => 'Ringo',
|
||||
'age' => 28,
|
||||
|
|
|
@ -25,7 +25,7 @@ class SelectOrderedTest extends DatabaseTestBase {
|
|||
*/
|
||||
function testSimpleSelectOrdered() {
|
||||
$query = db_select('test');
|
||||
$name_field = $query->addField('test', 'name');
|
||||
$query->addField('test', 'name');
|
||||
$age_field = $query->addField('test', 'age', 'age');
|
||||
$query->orderBy($age_field);
|
||||
$result = $query->execute();
|
||||
|
@ -46,7 +46,7 @@ class SelectOrderedTest extends DatabaseTestBase {
|
|||
*/
|
||||
function testSimpleSelectMultiOrdered() {
|
||||
$query = db_select('test');
|
||||
$name_field = $query->addField('test', 'name');
|
||||
$query->addField('test', 'name');
|
||||
$age_field = $query->addField('test', 'age', 'age');
|
||||
$job_field = $query->addField('test', 'job');
|
||||
$query->orderBy($job_field);
|
||||
|
@ -77,7 +77,7 @@ class SelectOrderedTest extends DatabaseTestBase {
|
|||
*/
|
||||
function testSimpleSelectOrderedDesc() {
|
||||
$query = db_select('test');
|
||||
$name_field = $query->addField('test', 'name');
|
||||
$query->addField('test', 'name');
|
||||
$age_field = $query->addField('test', 'age', 'age');
|
||||
$query->orderBy($age_field, 'DESC');
|
||||
$result = $query->execute();
|
||||
|
|
|
@ -68,7 +68,6 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase {
|
|||
if ($this->entity->getEntityType()->isFieldable()) {
|
||||
// Add field, so we can modify the Field and FieldInstance entities to
|
||||
// verify that changes to those indeed clear cache tags.
|
||||
$field_name = drupal_strtolower($this->randomName());
|
||||
entity_create('field_config', array(
|
||||
'name' => 'configurable_field',
|
||||
'entity_type' => $this->entity->getEntityTypeId(),
|
||||
|
|
|
@ -166,11 +166,11 @@ class ElementsTableSelectTest extends WebTestBase {
|
|||
);
|
||||
|
||||
// Test with a valid value.
|
||||
list($processed_form, $form_state, $errors) = $this->formSubmitHelper($form, array('tableselect' => array('row1' => 'row1')));
|
||||
list(, , $errors) = $this->formSubmitHelper($form, array('tableselect' => array('row1' => 'row1')));
|
||||
$this->assertFalse(isset($errors['tableselect']), 'Option checker allows valid values for checkboxes.');
|
||||
|
||||
// Test with an invalid value.
|
||||
list($processed_form, $form_state, $errors) = $this->formSubmitHelper($form, array('tableselect' => array('non_existing_value' => 'non_existing_value')));
|
||||
list(, , $errors) = $this->formSubmitHelper($form, array('tableselect' => array('non_existing_value' => 'non_existing_value')));
|
||||
$this->assertTrue(isset($errors['tableselect']), 'Option checker disallows invalid values for checkboxes.');
|
||||
|
||||
}
|
||||
|
@ -191,11 +191,11 @@ class ElementsTableSelectTest extends WebTestBase {
|
|||
);
|
||||
|
||||
// Test with a valid value.
|
||||
list($processed_form, $form_state, $errors) = $this->formSubmitHelper($form, array('tableselect' => 'row1'));
|
||||
list(, , $errors) = $this->formSubmitHelper($form, array('tableselect' => 'row1'));
|
||||
$this->assertFalse(isset($errors['tableselect']), 'Option checker allows valid values for radio buttons.');
|
||||
|
||||
// Test with an invalid value.
|
||||
list($processed_form, $form_state, $errors) = $this->formSubmitHelper($form, array('tableselect' => 'non_existing_value'));
|
||||
list(, , $errors) = $this->formSubmitHelper($form, array('tableselect' => 'non_existing_value'));
|
||||
$this->assertTrue(isset($errors['tableselect']), 'Option checker disallows invalid values for radio buttons.');
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ class LockFunctionalTest extends WebTestBase {
|
|||
|
||||
// Check the shut-down function.
|
||||
$lock_acquired_exit = 'TRUE: Lock successfully acquired in system_test_lock_exit()';
|
||||
$lock_not_acquired_exit = 'FALSE: Lock not acquired in system_test_lock_exit()';
|
||||
$this->drupalGet('system-test/lock-exit');
|
||||
$this->assertText($lock_acquired_exit, 'Lock acquired by the other request before exit.', 'Lock');
|
||||
$this->assertTrue($lock->acquire('system_test_lock_exit'), 'Lock acquired by this request after the other request exits.', 'Lock');
|
||||
|
|
|
@ -52,7 +52,7 @@ class FrontPageTest extends WebTestBase {
|
|||
'title' => $this->randomName(8),
|
||||
'promote' => 1,
|
||||
);
|
||||
$node = $this->drupalCreateNode($settings);
|
||||
$this->drupalCreateNode($settings);
|
||||
$this->drupalGet('');
|
||||
$this->assertTitle('Home | Drupal');
|
||||
|
||||
|
|
|
@ -125,8 +125,6 @@ class SystemControllerTest extends UnitTestCase {
|
|||
'language' => 'nl',
|
||||
'query' => array(),
|
||||
);
|
||||
// Nothing to do.
|
||||
$markup = '<foo>bar</foo>';
|
||||
$situations[] = array('context' => $context, 'is active' => FALSE, 'attributes' => array());
|
||||
// Matching path, plus all matching variations.
|
||||
$attributes = array(
|
||||
|
@ -162,8 +160,6 @@ class SystemControllerTest extends UnitTestCase {
|
|||
'language' => 'nl',
|
||||
'query' => array('foo' => 'bar'),
|
||||
);
|
||||
// Nothing to do.
|
||||
$markup = '<foo>bar</foo>';
|
||||
$situations[] = array('context' => $context, 'is active' => FALSE, 'attributes' => array());
|
||||
// Matching path, plus all matching variations.
|
||||
$attributes = array(
|
||||
|
@ -195,8 +191,6 @@ class SystemControllerTest extends UnitTestCase {
|
|||
'language' => 'nl',
|
||||
'query' => array('foo' => 'bar'),
|
||||
);
|
||||
// Nothing to do.
|
||||
$markup = '<foo>bar</foo>';
|
||||
$situations[] = array('context' => $context, 'is active' => FALSE, 'attributes' => array());
|
||||
// Matching path, plus all matching variations.
|
||||
$attributes = array(
|
||||
|
@ -232,8 +226,6 @@ class SystemControllerTest extends UnitTestCase {
|
|||
'language' => 'en',
|
||||
'query' => array('foo' => 'bar'),
|
||||
);
|
||||
// Nothing to do.
|
||||
$markup = '<foo>bar</foo>';
|
||||
$situations[] = array('context' => $context, 'is active' => FALSE, 'attributes' => array());
|
||||
// Matching path, plus all matching variations.
|
||||
$attributes = array(
|
||||
|
|
Loading…
Reference in New Issue