Tests creating a block type programmatically and via a form.
public function testCustomBlockTypeCreation() {
// Create a block type programmaticaly.
$type = $this
->createCustomBlockType('other');
$block_type = entity_load('custom_block_type', 'other');
$this
->assertTrue($block_type, 'The new block type has been created.');
// Login a test user.
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('block/add/' . $type
->id());
$this
->assertResponse(200, 'The new block type can be accessed at bloack/add.');
// Create a block type via the user interface.
$edit = array(
'id' => 'foo',
'label' => 'title for foo',
);
$this
->drupalPost('admin/structure/custom-blocks/add', $edit, t('Save'));
$block_type = entity_load('custom_block_type', 'foo');
$this
->assertTrue($block_type, 'The new block type has been created.');
// Check that the block type was created in site default language.
$default_langcode = language_default()->langcode;
$this
->assertEqual($block_type->langcode, $default_langcode);
}