protected function PreviewTest::assertPreviewAJAX in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views_ui/src/Tests/PreviewTest.php \Drupal\views_ui\Tests\PreviewTest::assertPreviewAJAX()
Assert that the AJAX response contains expected data.
Parameters
array $result: An array of AJAX commands.
int $row_count: The expected number of rows in the preview.
2 calls to PreviewTest::assertPreviewAJAX()
- PreviewTest::clickPreviewLinkAJAX in core/
modules/ views_ui/ src/ Tests/ PreviewTest.php - Mimic clicking on a preview link.
- PreviewTest::getPreviewAJAX in core/
modules/ views_ui/ src/ Tests/ PreviewTest.php - Get the preview form and force an AJAX preview update.
File
- core/
modules/ views_ui/ src/ Tests/ PreviewTest.php, line 281 - Contains \Drupal\views_ui\Tests\PreviewTest.
Class
- PreviewTest
- Tests the UI preview functionality.
Namespace
Drupal\views_ui\TestsCode
protected function assertPreviewAJAX($result, $row_count) {
// Has AJAX callback replied with an insert command? If so, we can
// assume that the page content was updated with AJAX returned data.
$result_commands = array();
foreach ($result as $command) {
$result_commands[$command['command']] = $command;
}
$this
->assertTrue(isset($result_commands['insert']), 'AJAX insert command received.');
// Test if preview contains the expected number of rows.
$elements = $this
->xpath('//div[@class = "view-content"]/div[contains(@class, views-row)]');
$this
->assertEqual(count($elements), $row_count, 'Expected items found on page.');
}