NewDefaultThemeBlocksTest.php in MongoDB 7
File
mongodb_block_ui/src/Tests/NewDefaultThemeBlocksTest.php
View source
<?php
namespace Drupal\mongodb_block_ui\Tests;
class NewDefaultThemeBlocksTest extends \DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'New default theme blocks',
'description' => 'Checks that the new default theme gets blocks.',
'group' => 'MongoDB: Block',
);
}
public function testNewDefaultThemeBlocks() {
$adminuser = $this
->drupalCreateUser(array(
'administer themes',
));
$this
->drupalLogin($adminuser);
$count = db_query_range("SELECT 1 FROM {block} WHERE theme NOT IN ('garland', 'seven')", 0, 1)
->fetchField();
$this
->assertFalse($count, t('Only Garland and Seven have blocks.'));
$blocks = array();
$result = db_query("SELECT * FROM {block} WHERE theme = 'garland'");
foreach ($result as $block) {
unset($block->theme, $block->bid);
$blocks[$block->module][$block->delta] = $block;
}
theme_enable(array(
'stark',
));
variable_set('theme_default', 'stark');
$result = db_query("SELECT * FROM {block} WHERE theme='stark'");
foreach ($result as $block) {
unset($block->theme, $block->bid);
$this
->assertEqual($blocks[$block->module][$block->delta], $block, t('Block %name matched', array(
'%name' => $block->module . '-' . $block->delta,
)));
}
}
}