public function AccordionBlocksTest::testCreateAccordionBlock in Accordion Blocks 8
Test create accordion block
Tests for the following:
- Create accordion block
- Displaying of accordion block on the specified region.
File
- src/
Tests/ AccordionBlocksTest.php, line 83 - Contains Drupal\accordion_blocks\Tests\AccordionBlocksTest.
Class
- AccordionBlocksTest
- Test that Accordion Blocks Custom Block Type is created and block widgets are working.
Namespace
Drupal\accordion_blocks\TestsCode
public function testCreateAccordionBlock() {
$admin_user = $this
->drupalCreateUser(array(
'administer blocks',
'administer block_content display',
));
$this
->drupalLogin($admin_user);
// Create a block.
$edit = array();
$edit['info[0][value]'] = 'Test Block';
$edit['field_blocks[0][target_id]'] = 'User account menu (bartik_account_menu)';
$edit['field_blocks[1][target_id]'] = 'Footer menu (bartik_footer)';
$edit['field_blocks[2][target_id]'] = 'Powered by Drupal (bartik_powered)';
$this
->drupalGet('block/add/accordion_block');
$this
->drupalPostForm(NULL, array(), t('Add another item'));
$this
->drupalPostForm(NULL, array(), t('Add another item'));
$this
->drupalPostForm(NULL, $edit, t('Save'));
// Check that the Basic block has been created.
$this
->assertRaw(format_string('@block %name has been created.', array(
'@block' => 'Accordion block',
'%name' => 'Test Block',
)), 'Accordion block created.');
//$this->drupalPostForm(NULL, NULL, t('Save block'));
//$this->drupalPlaceBlock('testblock', array('id' => 'test_block', 'label' => 'Test Block', 'region' => 'sidebar_first'));
//$this->drupalGet('/node');
//$block = $this->xpath('//div[@id=sidebar-first]/div[contains(@class, accordion_blocks_container)]');
//$this->assertTrue(!empty($block));
}