1.20.x layout.test | protected LayoutUpgradePathTest::assertBlocks($blocks, $negate = FALSE) |
File
- modules/
layout/ tests/ layout.test, line 2631 - Tests for the Layout module.
Class
- LayoutUpgradePathTest
- Tests the upgrade path from block-based regions to layouts.
Code
protected function assertBlocks($blocks, $negate = FALSE) {
foreach ($blocks as $region => $block_classes) {
$selector = '//*[contains(@class,:region)]//*[contains(@class,:block)]';
foreach ($block_classes as $block_class) {
$elements = $this->xpath($selector, array(
':region' => $region,
':block' => $block_class,
));
if ($negate) {
$this->assertEqual(count($elements), 0, format_string('The block "@class" was correctly NOT shown in the "@region" region on the path "@path".', array('@class' => $block_class, '@region' => $region, '@path' => $this->getUrl())));
}
else {
$this->assertEqual(count($elements), 1, format_string('The block "@class" was found in the "@region" region on the path "@path".', array('@class' => $block_class, '@region' => $region, '@path' => $this->getUrl())));
}
}
}
}