$this->
assertEquals(27 * 2,
$record->
{$age_double_field}, 'Fetched double age expression is correct.'
);
$this->
assertEquals(27 * 3,
$record->
{$age_triple_field}, 'Fetched triple age expression is correct.'
);
} /**
* Tests adding multiple fields to a SELECT statement at the same time.
*/
public function testSimpleSelectMultipleFields() { $record =
$this->connection->
select('test'
) ->
fields('test',
['id', 'name', 'age', 'job'
]) ->
condition('age', 27
) ->
execute()->
fetchObject();
// Check that all fields we asked for are present.
$this->
assertNotNull($record->id, 'ID field is present.'
);
$this->
assertNotNull($record->name, 'Name field is present.'
);
$this->
assertNotNull($record->age, 'Age field is present.'
);
$this->
assertNotNull($record->job, 'Job field is present.'
);
// Ensure that we got the right record.
// Check that all fields we asked for are present.
$this->
assertEquals(2,
$record->id, 'ID field has the correct value.'
);
$this->
assertEquals('George',
$record->name, 'Name field has the correct value.'
);