function BoxesAjaxTestCase::ajaxLoadBoxesBlock in Boxes 6
Same name and namespace in other branches
- 7 tests/boxes.test \BoxesAjaxTestCase::ajaxLoadBoxesBlock()
Load a block via the context ajax callback and set the payload as the content for simpletest.
2 calls to BoxesAjaxTestCase::ajaxLoadBoxesBlock()
- BoxesBasicAjaxTestCase::testAjaxBoxes in tests/
boxes.test - Test creating and deleting a box.
- BoxesSpacesTestCase::runTest in tests/
boxes.test
File
- tests/
boxes.test, line 83
Class
Code
function ajaxLoadBoxesBlock($delta, $path = 'node') {
$this
->drupalGet($path, array(
'query' => array(
'boxes_delta' => $delta,
),
));
$response = $this
->parseJSON();
$block = null;
foreach ($response as $command) {
if ($command->command == 'replace') {
$block = $command->data;
break;
}
}
if ($block) {
$this
->pass("Loaded block");
// Replace contents of the reponse with the decoded JSON
$this->content = $block;
unset($this->elements);
}
else {
$this
->fail('Failed to load block');
}
}