Commit f988a548 authored by jhodgdon's avatar jhodgdon

Issue #1794012 by Lars Toomre: Remove use of t function from test assertion messages

parent 0790cd97
......@@ -38,7 +38,7 @@ function testSimpleAlter() {
$num_records++;
}
$this->assertEqual($num_records, 2, t('Returned the correct number of rows.'));
$this->assertEqual($num_records, 2, 'Returned the correct number of rows.');
}
/**
......@@ -55,14 +55,14 @@ function testAlterWithJoin() {
$records = $result->fetchAll();
$this->assertEqual(count($records), 2, t('Returned the correct number of rows.'));
$this->assertEqual(count($records), 2, 'Returned the correct number of rows.');
$this->assertEqual($records[0]->name, 'George', t('Correct data retrieved.'));
$this->assertEqual($records[0]->$tid_field, 4, t('Correct data retrieved.'));
$this->assertEqual($records[0]->$task_field, 'sing', t('Correct data retrieved.'));
$this->assertEqual($records[1]->name, 'George', t('Correct data retrieved.'));
$this->assertEqual($records[1]->$tid_field, 5, t('Correct data retrieved.'));
$this->assertEqual($records[1]->$task_field, 'sleep', t('Correct data retrieved.'));
$this->assertEqual($records[0]->name, 'George', 'Correct data retrieved.');
$this->assertEqual($records[0]->$tid_field, 4, 'Correct data retrieved.');
$this->assertEqual($records[0]->$task_field, 'sing', 'Correct data retrieved.');
$this->assertEqual($records[1]->name, 'George', 'Correct data retrieved.');
$this->assertEqual($records[1]->$tid_field, 5, 'Correct data retrieved.');
$this->assertEqual($records[1]->$task_field, 'sleep', 'Correct data retrieved.');
}
/**
......@@ -83,11 +83,11 @@ function testAlterChangeConditional() {
$records = $result->fetchAll();
$this->assertEqual(count($records), 1, t('Returned the correct number of rows.'));
$this->assertEqual($records[0]->$name_field, 'John', t('Correct data retrieved.'));
$this->assertEqual($records[0]->$tid_field, 2, t('Correct data retrieved.'));
$this->assertEqual($records[0]->$pid_field, 1, t('Correct data retrieved.'));
$this->assertEqual($records[0]->$task_field, 'sleep', t('Correct data retrieved.'));
$this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
$this->assertEqual($records[0]->$name_field, 'John', 'Correct data retrieved.');
$this->assertEqual($records[0]->$tid_field, 2, 'Correct data retrieved.');
$this->assertEqual($records[0]->$pid_field, 1, 'Correct data retrieved.');
$this->assertEqual($records[0]->$task_field, 'sleep', 'Correct data retrieved.');
}
/**
......@@ -101,8 +101,8 @@ function testAlterChangeFields() {
$query->addTag('database_test_alter_change_fields');
$record = $query->execute()->fetch();
$this->assertEqual($record->$name_field, 'George', t('Correct data retrieved.'));
$this->assertFalse(isset($record->$age_field), t('Age field not found, as intended.'));
$this->assertEqual($record->$name_field, 'George', 'Correct data retrieved.');
$this->assertFalse(isset($record->$age_field), 'Age field not found, as intended.');
}
/**
......@@ -119,8 +119,8 @@ function testAlterExpression() {
// Ensure that we got the right record.
$record = $result->fetch();
$this->assertEqual($record->$name_field, 'George', t('Fetched name is correct.'));
$this->assertEqual($record->$age_field, 27*3, t('Fetched age expression is correct.'));
$this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
$this->assertEqual($record->$age_field, 27*3, 'Fetched age expression is correct.');
}
/**
......@@ -135,7 +135,7 @@ function testAlterRemoveRange() {
$num_records = count($query->execute()->fetchAll());
$this->assertEqual($num_records, 4, t('Returned the correct number of rows.'));
$this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
}
/**
......@@ -159,7 +159,7 @@ function testSimpleAlterSubquery() {
$name_field = $query->addField('pq', 'name');
$record = $query->execute()->fetch();
$this->assertEqual($record->$name_field, 'George', t('Fetched name is correct.'));
$this->assertEqual($record->$age_field, 27*3, t('Fetched age expression is correct.'));
$this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
$this->assertEqual($record->$age_field, 27*3, 'Fetched age expression is correct.');
}
}
......@@ -34,7 +34,7 @@ function testBasicConcat() {
':a4' => ' a ',
':a5' => 'test.',
));
$this->assertIdentical($result->fetchField(), 'This is a test.', t('Basic CONCAT works.'));
$this->assertIdentical($result->fetchField(), 'This is a test.', 'Basic CONCAT works.');
}
/**
......@@ -47,7 +47,7 @@ function testFieldConcat() {
':a3' => '.',
':age' => 25,
));
$this->assertIdentical($result->fetchField(), 'The age of John is 25.', t('Field CONCAT works.'));
$this->assertIdentical($result->fetchField(), 'The age of John is 25.', 'Field CONCAT works.');
}
/**
......@@ -66,14 +66,14 @@ function testLikeEscape() {
->countQuery()
->execute()
->fetchField();
$this->assertIdentical($num_matches, '2', t('Found 2 records.'));
$this->assertIdentical($num_matches, '2', 'Found 2 records.');
// Match only "Ring_" using a LIKE expression with no wildcards.
$num_matches = db_select('test', 't')
->condition('name', db_like('Ring_'), 'LIKE')
->countQuery()
->execute()
->fetchField();
$this->assertIdentical($num_matches, '1', t('Found 1 record.'));
$this->assertIdentical($num_matches, '1', 'Found 1 record.');
}
/**
......@@ -97,13 +97,13 @@ function testLikeBackslash() {
->countQuery()
->execute()
->fetchField();
$this->assertIdentical($num_matches, '2', t('Found 2 records.'));
$this->assertIdentical($num_matches, '2', 'Found 2 records.');
// Match only the former using a LIKE expression with no wildcards.
$num_matches = db_select('test', 't')
->condition('name', db_like('abc%\_'), 'LIKE')
->countQuery()
->execute()
->fetchField();
$this->assertIdentical($num_matches, '1', t('Found 1 record.'));
$this->assertIdentical($num_matches, '1', 'Found 1 record.');
}
}
......@@ -34,8 +34,8 @@ function testCaseSensitiveInsert() {
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
$this->assertIdentical($num_records_before + 1, (int) $num_records_after, t('Record inserts correctly.'));
$this->assertIdentical($num_records_before + 1, (int) $num_records_after, 'Record inserts correctly.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'john'))->fetchField();
$this->assertIdentical($saved_age, '2', t('Can retrieve after inserting.'));
$this->assertIdentical($saved_age, '2', 'Can retrieve after inserting.');
}
}
......@@ -35,25 +35,25 @@ function testConnectionRouting() {
$db1 = Database::getConnection('default', 'default');
$db2 = Database::getConnection('slave', 'default');
$this->assertNotNull($db1, t('default connection is a real connection object.'));
$this->assertNotNull($db2, t('slave connection is a real connection object.'));
$this->assertNotIdentical($db1, $db2, t('Each target refers to a different connection.'));
$this->assertNotNull($db1, 'default connection is a real connection object.');
$this->assertNotNull($db2, 'slave connection is a real connection object.');
$this->assertNotIdentical($db1, $db2, 'Each target refers to a different connection.');
// Try to open those targets another time, that should return the same objects.
$db1b = Database::getConnection('default', 'default');
$db2b = Database::getConnection('slave', 'default');
$this->assertIdentical($db1, $db1b, t('A second call to getConnection() returns the same object.'));
$this->assertIdentical($db2, $db2b, t('A second call to getConnection() returns the same object.'));
$this->assertIdentical($db1, $db1b, 'A second call to getConnection() returns the same object.');
$this->assertIdentical($db2, $db2b, 'A second call to getConnection() returns the same object.');
// Try to open an unknown target.
$unknown_target = $this->randomName();
$db3 = Database::getConnection($unknown_target, 'default');
$this->assertNotNull($db3, t('Opening an unknown target returns a real connection object.'));
$this->assertIdentical($db1, $db3, t('An unknown target opens the default connection.'));
$this->assertNotNull($db3, 'Opening an unknown target returns a real connection object.');
$this->assertIdentical($db1, $db3, 'An unknown target opens the default connection.');
// Try to open that unknown target another time, that should return the same object.
$db3b = Database::getConnection($unknown_target, 'default');
$this->assertIdentical($db3, $db3b, t('A second call to getConnection() returns the same object.'));
$this->assertIdentical($db3, $db3b, 'A second call to getConnection() returns the same object.');
}
/**
......@@ -71,7 +71,7 @@ function testConnectionRoutingOverride() {
$db1 = Database::getConnection('default', 'default');
$db2 = Database::getConnection('slave', 'default');
$this->assertIdentical($db1, $db2, t('Both targets refer to the same connection.'));
$this->assertIdentical($db1, $db2, 'Both targets refer to the same connection.');
}
/**
......@@ -86,7 +86,7 @@ function testConnectionClosing() {
$db2 = Database::getConnection('default', 'default');
// Opening a connection after closing it should yield an object different than the original.
$this->assertNotIdentical($db1, $db2, t('Opening the default connection after it is closed returns a new object.'));
$this->assertNotIdentical($db1, $db2, 'Opening the default connection after it is closed returns a new object.');
}
/**
......@@ -101,8 +101,8 @@ function testConnectionOptions() {
// In the MySQL driver, the port can be different, so check individual
// options.
$this->assertEqual($connection_info['default']['driver'], $connectionOptions['driver'], t('The default connection info driver matches the current connection options driver.'));
$this->assertEqual($connection_info['default']['database'], $connectionOptions['database'], t('The default connection info database matches the current connection options database.'));
$this->assertEqual($connection_info['default']['driver'], $connectionOptions['driver'], 'The default connection info driver matches the current connection options driver.');
$this->assertEqual($connection_info['default']['database'], $connectionOptions['database'], 'The default connection info database matches the current connection options database.');
// Set up identical slave and confirm connection options are identical.
Database::addConnectionInfo('default', 'slave', $connection_info['default']);
......@@ -111,7 +111,7 @@ function testConnectionOptions() {
// Get a fresh copy of the default connection options.
$connectionOptions = $db->getConnectionOptions();
$this->assertIdentical($connectionOptions, $connectionOptions2, t('The default and slave connection options are identical.'));
$this->assertIdentical($connectionOptions, $connectionOptions2, 'The default and slave connection options are identical.');
// Set up a new connection with different connection info.
$test = $connection_info['default'];
......@@ -121,6 +121,6 @@ function testConnectionOptions() {
// Get a fresh copy of the default connection options.
$connectionOptions = $db->getConnectionOptions();
$this->assertNotEqual($connection_info['default']['database'], $connectionOptions['database'], t('The test connection info database does not match the current connection options database.'));
$this->assertNotEqual($connection_info['default']['database'], $connectionOptions['database'], 'The test connection info database does not match the current connection options database.');
}
}
......@@ -54,7 +54,7 @@ function installTables($schema) {
}
foreach ($schema as $name => $data) {
$this->assertTrue(db_table_exists($name), t('Table @name created successfully.', array('@name' => $name)));
$this->assertTrue(db_table_exists($name), format_string('Table @name created successfully.', array('@name' => $name)));
}
}
......
......@@ -43,10 +43,10 @@ function testSubselectDelete() {
->condition('pid', $subquery, 'IN');
$num_deleted = $delete->execute();
$this->assertEqual($num_deleted, 1, t("Deleted 1 record."));
$this->assertEqual($num_deleted, 1, 'Deleted 1 record.');
$num_records_after = db_query('SELECT COUNT(*) FROM {test_task}')->fetchField();
$this->assertEqual($num_records_before, $num_records_after + $num_deleted, t('Deletion adds up.'));
$this->assertEqual($num_records_before, $num_records_after + $num_deleted, 'Deletion adds up.');
}
/**
......@@ -58,10 +58,10 @@ function testSimpleDelete() {
$num_deleted = db_delete('test')
->condition('id', 1)
->execute();
$this->assertIdentical($num_deleted, 1, t('Deleted 1 record.'));
$this->assertIdentical($num_deleted, 1, 'Deleted 1 record.');
$num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
$this->assertEqual($num_records_before, $num_records_after + $num_deleted, t('Deletion adds up.'));
$this->assertEqual($num_records_before, $num_records_after + $num_deleted, 'Deletion adds up.');
}
/**
......@@ -73,6 +73,6 @@ function testTruncate() {
db_truncate('test')->execute();
$num_records_after = db_query("SELECT COUNT(*) FROM {test}")->fetchField();
$this->assertEqual(0, $num_records_after, t('Truncate really deletes everything.'));
$this->assertEqual(0, $num_records_after, 'Truncate really deletes everything.');
}
}
......@@ -29,8 +29,8 @@ public static function getInfo() {
function testEmpty() {
$result = new StatementEmpty();
$this->assertTrue($result instanceof StatementInterface, t('Class implements expected interface'));
$this->assertNull($result->fetchObject(), t('Null result returned.'));
$this->assertTrue($result instanceof StatementInterface, 'Class implements expected interface');
$this->assertNull($result->fetchObject(), 'Null result returned.');
}
/**
......@@ -40,11 +40,11 @@ function testEmptyIteration() {
$result = new StatementEmpty();
foreach ($result as $record) {
$this->fail(t('Iterating empty result set should not iterate.'));
$this->fail('Iterating empty result set should not iterate.');
return;
}
$this->pass(t('Iterating empty result set skipped iteration.'));
$this->pass('Iterating empty result set skipped iteration.');
}
/**
......@@ -53,6 +53,6 @@ function testEmptyIteration() {
function testEmptyFetchAll() {
$result = new StatementEmpty();
$this->assertEqual($result->fetchAll(), array(), t('Empty array returned from empty result set.'));
$this->assertEqual($result->fetchAll(), array(), 'Empty array returned from empty result set.');
}
}
......@@ -31,14 +31,14 @@ public static function getInfo() {
function testQueryFetchDefault() {
$records = array();
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25));
$this->assertTrue($result instanceof StatementInterface, t('Result set is a Drupal statement object.'));
$this->assertTrue($result instanceof StatementInterface, 'Result set is a Drupal statement object.');
foreach ($result as $record) {
$records[] = $record;
$this->assertTrue(is_object($record), t('Record is an object.'));
$this->assertIdentical($record->name, 'John', t('25 year old is John.'));
$this->assertTrue(is_object($record), 'Record is an object.');
$this->assertIdentical($record->name, 'John', '25 year old is John.');
}
$this->assertIdentical(count($records), 1, t('There is only one record.'));
$this->assertIdentical(count($records), 1, 'There is only one record.');
}
/**
......@@ -49,11 +49,11 @@ function testQueryFetchObject() {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_OBJ));
foreach ($result as $record) {
$records[] = $record;
$this->assertTrue(is_object($record), t('Record is an object.'));
$this->assertIdentical($record->name, 'John', t('25 year old is John.'));
$this->assertTrue(is_object($record), 'Record is an object.');
$this->assertIdentical($record->name, 'John', '25 year old is John.');
}
$this->assertIdentical(count($records), 1, t('There is only one record.'));
$this->assertIdentical(count($records), 1, 'There is only one record.');
}
/**
......@@ -64,12 +64,12 @@ function testQueryFetchArray() {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_ASSOC));
foreach ($result as $record) {
$records[] = $record;
if ($this->assertTrue(is_array($record), t('Record is an array.'))) {
$this->assertIdentical($record['name'], 'John', t('Record can be accessed associatively.'));
if ($this->assertTrue(is_array($record), 'Record is an array.')) {
$this->assertIdentical($record['name'], 'John', 'Record can be accessed associatively.');
}
}
$this->assertIdentical(count($records), 1, t('There is only one record.'));
$this->assertIdentical(count($records), 1, 'There is only one record.');
}
/**
......@@ -82,12 +82,12 @@ function testQueryFetchClass() {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => 'Drupal\system\Tests\Database\FakeRecord'));
foreach ($result as $record) {
$records[] = $record;
if ($this->assertTrue($record instanceof FakeRecord, t('Record is an object of class FakeRecord.'))) {
$this->assertIdentical($record->name, 'John', t('25 year old is John.'));
if ($this->assertTrue($record instanceof FakeRecord, 'Record is an object of class FakeRecord.')) {
$this->assertIdentical($record->name, 'John', '25 year old is John.');
}
}
$this->assertIdentical(count($records), 1, t('There is only one record.'));
$this->assertIdentical(count($records), 1, 'There is only one record.');
}
// Confirm that we can fetch a record into an indexed array explicitly.
......@@ -96,8 +96,8 @@ function testQueryFetchNum() {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_NUM));
foreach ($result as $record) {
$records[] = $record;
if ($this->assertTrue(is_array($record), t('Record is an array.'))) {
$this->assertIdentical($record[0], 'John', t('Record can be accessed numerically.'));
if ($this->assertTrue(is_array($record), 'Record is an array.')) {
$this->assertIdentical($record[0], 'John', 'Record can be accessed numerically.');
}
}
......@@ -112,13 +112,13 @@ function testQueryFetchBoth() {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_BOTH));
foreach ($result as $record) {
$records[] = $record;
if ($this->assertTrue(is_array($record), t('Record is an array.'))) {
$this->assertIdentical($record[0], 'John', t('Record can be accessed numerically.'));
$this->assertIdentical($record['name'], 'John', t('Record can be accessed associatively.'));
if ($this->assertTrue(is_array($record), 'Record is an array.')) {
$this->assertIdentical($record[0], 'John', 'Record can be accessed numerically.');
$this->assertIdentical($record['name'], 'John', 'Record can be accessed associatively.');
}
}
$this->assertIdentical(count($records), 1, t('There is only one record.'));
$this->assertIdentical(count($records), 1, 'There is only one record.');
}
/**
......@@ -128,12 +128,12 @@ function testQueryFetchCol() {
$records = array();
$result = db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25));
$column = $result->fetchCol();
$this->assertIdentical(count($column), 3, t('fetchCol() returns the right number of records.'));
$this->assertIdentical(count($column), 3, 'fetchCol() returns the right number of records.');
$result = db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25));
$i = 0;
foreach ($result as $record) {
$this->assertIdentical($record->name, $column[$i++], t('Column matches direct accesss.'));
$this->assertIdentical($record->name, $column[$i++], 'Column matches direct accesss.');
}
}
}
......@@ -32,7 +32,7 @@ function testDefaultInsert() {
$schema = drupal_get_schema('test');
$job = db_query('SELECT job FROM {test} WHERE id = :id', array(':id' => $id))->fetchField();
$this->assertEqual($job, $schema['fields']['job']['default'], t('Default field value is set.'));
$this->assertEqual($job, $schema['fields']['job']['default'], 'Default field value is set.');
}
/**
......@@ -44,13 +44,13 @@ function testDefaultEmptyInsert() {
try {
$result = db_insert('test')->execute();
// This is only executed if no exception has been thrown.
$this->fail(t('Expected exception NoFieldsException has not been thrown.'));
$this->fail('Expected exception NoFieldsException has not been thrown.');
} catch (NoFieldsException $e) {
$this->pass(t('Expected exception NoFieldsException has been thrown.'));
$this->pass('Expected exception NoFieldsException has been thrown.');
}
$num_records_after = (int) db_query('SELECT COUNT(*) FROM {test}')->fetchField();
$this->assertIdentical($num_records_before, $num_records_after, t('Do nothing as no fields are specified.'));
$this->assertIdentical($num_records_before, $num_records_after, 'Do nothing as no fields are specified.');
}
/**
......@@ -65,6 +65,6 @@ function testDefaultInsertWithFields() {
$schema = drupal_get_schema('test');
$job = db_query('SELECT job FROM {test} WHERE id = :id', array(':id' => $id))->fetchField();
$this->assertEqual($job, $schema['fields']['job']['default'], t('Default field value is set.'));
$this->assertEqual($job, $schema['fields']['job']['default'], 'Default field value is set.');
}
}
......@@ -25,12 +25,12 @@ public static function getInfo() {
*/
function testInsertOneBlob() {
$data = "This is\000a test.";
$this->assertTrue(strlen($data) === 15, t('Test data contains a NULL.'));
$this->assertTrue(strlen($data) === 15, 'Test data contains a NULL.');
$id = db_insert('test_one_blob')
->fields(array('blob1' => $data))
->execute();
$r = db_query('SELECT * FROM {test_one_blob} WHERE id = :id', array(':id' => $id))->fetchAssoc();
$this->assertTrue($r['blob1'] === $data, t('Can insert a blob: id @id, @data.', array('@id' => $id, '@data' => serialize($r))));
$this->assertTrue($r['blob1'] === $data, format_string('Can insert a blob: id @id, @data.', array('@id' => $id, '@data' => serialize($r))));
}
/**
......@@ -44,6 +44,6 @@ function testInsertMultipleBlob() {
))
->execute();
$r = db_query('SELECT * FROM {test_two_blobs} WHERE id = :id', array(':id' => $id))->fetchAssoc();
$this->assertTrue($r['blob1'] === 'This is' && $r['blob2'] === 'a test', t('Can insert multiple blobs per row.'));
$this->assertTrue($r['blob1'] === 'This is' && $r['blob2'] === 'a test', 'Can insert multiple blobs per row.');
}
}
......@@ -34,9 +34,9 @@ function testSimpleInsert() {
$query->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
$this->assertIdentical($num_records_before + 1, (int) $num_records_after, t('Record inserts correctly.'));
$this->assertIdentical($num_records_before + 1, (int) $num_records_after, 'Record inserts correctly.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Yoko'))->fetchField();
$this->assertIdentical($saved_age, '29', t('Can retrieve after inserting.'));
$this->assertIdentical($saved_age, '29', 'Can retrieve after inserting.');
}
/**
......@@ -63,13 +63,13 @@ function testMultiInsert() {
$query->execute();
$num_records_after = (int) db_query('SELECT COUNT(*) FROM {test}')->fetchField();
$this->assertIdentical($num_records_before + 3, $num_records_after, t('Record inserts correctly.'));
$this->assertIdentical($num_records_before + 3, $num_records_after, 'Record inserts correctly.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Larry'))->fetchField();
$this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.'));
$this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Curly'))->fetchField();
$this->assertIdentical($saved_age, '31', t('Can retrieve after inserting.'));
$this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Moe'))->fetchField();
$this->assertIdentical($saved_age, '32', t('Can retrieve after inserting.'));
$this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.');
}
/**
......@@ -98,13 +98,13 @@ function testRepeatedInsert() {
$query->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
$this->assertIdentical((int) $num_records_before + 3, (int) $num_records_after, t('Record inserts correctly.'));
$this->assertIdentical((int) $num_records_before + 3, (int) $num_records_after, 'Record inserts correctly.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Larry'))->fetchField();
$this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.'));
$this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Curly'))->fetchField();
$this->assertIdentical($saved_age, '31', t('Can retrieve after inserting.'));
$this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Moe'))->fetchField();
$this->assertIdentical($saved_age, '32', t('Can retrieve after inserting.'));
$this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.');
}
/**
......@@ -120,11 +120,11 @@ function testInsertFieldOnlyDefinintion() {
->values(array('Moe', '32'))
->execute();
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Larry'))->fetchField();
$this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.'));
$this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Curly'))->fetchField();
$this->assertIdentical($saved_age, '31', t('Can retrieve after inserting.'));
$this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Moe'))->fetchField();
$this->assertIdentical($saved_age, '32', t('Can retrieve after inserting.'));
$this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.');
}
/**
......@@ -138,7 +138,7 @@ function testInsertLastInsertID() {
))
->execute();
$this->assertIdentical($id, '5', t('Auto-increment ID returned successfully.'));
$this->assertIdentical($id, '5', 'Auto-increment ID returned successfully.');
}
/**
......@@ -164,6 +164,6 @@ function testInsertSelect() {
->execute();
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Meredith'))->fetchField();
$this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.'));
$this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.');
}
}
......@@ -44,7 +44,7 @@ function testInsertDuplicateData() {
'job' => 'Singer',
))
->execute();
$this->fail(t('Insert succeedded when it should not have.'));
$this->fail('Insert succeedded when it should not have.');
}
catch (Exception $e) {
// Check if the first record was inserted.
......@@ -56,14 +56,14 @@ function testInsertDuplicateData() {
// Database engines that don't support transactions can leave partial
// inserts in place when an error occurs. This is the case for MySQL
// when running on a MyISAM table.
$this->pass(t("The whole transaction has not been rolled-back when a duplicate key insert occurs, this is expected because the database doesn't support transactions"));
$this->pass("The whole transaction has not been rolled-back when a duplicate key insert occurs, this is expected because the database doesn't support transactions");
}
else {
$this->fail(t('The whole transaction is rolled back when a duplicate key insert occurs.'));
$this->fail('The whole transaction is rolled back when a duplicate key insert occurs.');
}
}
else {
$this->pass(t('The whole transaction is rolled back when a duplicate key insert occurs.'));
$this->pass('The whole transaction is rolled back when a duplicate key insert occurs.');
}
// Ensure the other values were not inserted.
......@@ -72,7 +72,7 @@ function testInsertDuplicateData() {
->condition('age', array(17, 75), 'IN')
->execute()->fetchObject();
$this->assertFalse($record, t('The rest of the insert aborted as expected.'));
$this->assertFalse($record, 'The rest of the insert aborted as expected.');
}
}
......
......@@ -36,10 +36,10 @@ function testEnableLogging() {
$queries = Database::getLog('testing', 'default');
$this->assertEqual(count($queries), 3, t('Correct number of queries recorded.'));
$this->assertEqual(count($queries), 3, 'Correct number of queries recorded.');
foreach ($queries as $query) {
$this->assertEqual($query['caller']['function'], __FUNCTION__, t('Correct function in query log.'));
$this->assertEqual($query['caller']['function'], __FUNCTION__, 'Correct function in query log.');
}
}
......@@ -58,8 +58,8 @@ function testEnableMultiLogging() {
$queries1 = Database::getLog('testing1');
$queries2 = Database::getLog('testing2');
$this->assertEqual(count($queries1), 2, t('Correct number of queries recorded for log 1.'));
$this->assertEqual(count($queries2), 1, t('Correct number of queries recorded for log 2.'));
$this->assertEqual(count($queries1), 2, 'Correct number of queries recorded for log 1.');
$this->assertEqual(count($queries2), 1, 'Correct number of queries recorded for log 2.');
}
/**
......@@ -79,9 +79,9 @@ function testEnableTargetLogging() {
$queries1 = Database::getLog('testing1');
$this->assertEqual(count($queries1), 2, t('Recorded queries from all targets.'));
$this->assertEqual($queries1[0]['target'], 'default', t('First query used default target.'));
$this->assertEqual($queries1[1]['target'], 'slave', t('Second query used slave target.'));
$this->assertEqual(count($queries1), 2, 'Recorded queries from all targets.');
$this->assertEqual($queries1[0]['target'], 'default', 'First query used default target.');
$this->assertEqual($queries1[1]['target'], 'slave', 'Second query used slave target.');
}
/**
......@@ -105,9 +105,9 @@ function testEnableTargetLoggingNoTarget() {
$queries1 = Database::getLog('testing1');
$this->assertEqual(count($queries1), 2, t('Recorded queries from all targets.'));
$this->assertEqual($queries1[0]['target'], 'default', t('First query used default target.'));
$this->assertEqual($queries1[1]['target'], 'default', t('Second query used default target as fallback.'));
$this->assertEqual(count($queries1), 2, 'Recorded queries from all targets.');
$this->assertEqual($queries1[0]['target'], 'default', 'First query used default target.');
$this->assertEqual($queries1[1]['target'], 'default', 'Second query used default target as fallback.');
}
/**
......@@ -133,7 +133,7 @@ function testEnableMultiConnectionLogging() {
$queries1 = Database::getLog('testing1');
$queries2 = Database::getLog('testing1', 'test2');
$this->assertEqual(count($queries1), 1, t('Correct number of queries recorded for first connection.'));
$this->assertEqual(count($queries2), 1, t('Correct number of queries recorded for second connection.'));
$this->assertEqual(count($queries1), 1, 'Correct number of queries recorded for first connection.');
$this->assertEqual(count($queries2), 1, 'Correct number of queries recorded for second connection.');
}
}
......@@ -37,15 +37,15 @@ function testMergeInsert() {
))
->execute();
$this->assertEqual($result, Merge::STATUS_INSERT, t('Insert status returned.'));
$this->assertEqual($result, Merge::STATUS_INSERT, 'Insert status returned.');
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
$this->assertEqual($num_records_before + 1, $num_records_after, t('Merge inserted properly.'));
$this->assertEqual($num_records_before + 1, $num_records_after, 'Merge inserted properly.');
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job'