1 views_handler_field_bulk_form.test | ViewsHandlerFieldBulkFormTest::assertCorrectBulkFormEntityIds($id_field, $entity_type) |
Assert that the form checkbox values match the entity ids.
File
- core/
modules/ views/ tests/ handlers/ views_handler_field_bulk_form.test, line 114 - Definition of ViewsHandlerFieldBulkFormTest.
Class
Code
function assertCorrectBulkFormEntityIds($id_field, $entity_type) {
// Generate a preview of the view in order to populate the field aliases.
$this->view->preview();
$field_alias = $this->view->field[$id_field]->field_alias;
// Get the view so that we access the Bulk Form.
$this->backdropGet('test-bulk-form');
// Iterate through the results to check that the entity id matches the
// value of the bulk form checkbox.
foreach ($this->view->result as $row_index => $row) {
$xpath = $this->buildXPathQuery('//input[@id=:id]', array(':id' => 'edit-bulk-form-' . $row_index));
$this->assertFieldByXPath($xpath, $row->$field_alias, "Bulk form checkbox value in row $row_index matches the value ({$row->$field_alias}) for field '$id_field' of the $entity_type entity.");
}
}