Skip to content
Snippets Groups Projects
Select Git revision
  • 3478204-fix-missingparamtype-in
  • 11.x default
  • 10.3.x
  • 10.4.x
  • 11.0.x
  • 10.2.x
  • 7.x
  • 10.1.x
  • 9.5.x
  • 10.0.x
  • 9.4.x
  • 9.3.x
  • 9.2.x
  • 9.1.x
  • 8.9.x
  • 9.0.x
  • 8.8.x
  • 8.7.x
  • 8.6.x
  • 8.5.x
  • previous/3478204-fix-missingparamtype-in/2024-12-19
  • previous/3478204-fix-missingparamtype-in/2024-11-21
  • previous/3478204-fix-missingparamtype-in/2024-10-26
  • previous/3478204-fix-missingparamtype-in/2024-10-19
  • 10.3.5
  • 11.0.4
  • 10.2.8
  • 10.3.4
  • 11.0.3
  • 10.3.3
  • 11.0.2
  • 10.3.2
  • 11.0.1
  • 11.0.0
  • 11.0.0-rc1
  • 10.3.1
  • 10.3.0
  • 10.2.7
  • 10.3.0-rc1
  • 7.101
40 results

.htaccess

Blame
  • Forked from project / drupal
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    BlockContentCreationTest.php 8.47 KiB
    <?php
    
    /**
     * @file
     * Contains \Drupal\block_content\Tests\BlockContentCreationTest.
     */
    
    namespace Drupal\block_content\Tests;
    
    use Drupal\Component\Utility\Unicode;
    use Drupal\Core\Database\Database;
    use Drupal\block_content\Entity\BlockContent;
    
    /**
     * Create a block and test saving it.
     *
     * @group block_content
     */
    class BlockContentCreationTest extends BlockContentTestBase {
    
      /**
       * Modules to enable.
       *
       * Enable dummy module that implements hook_block_insert() for exceptions.
       *
       * @var array
       */
      public static $modules = array('block_content_test', 'dblog', 'field_ui');
    
      /**
       * Sets the test up.
       */
      protected function setUp() {
        parent::setUp();
        $this->drupalLogin($this->adminUser);
      }
    
      /**
       * Creates a "Basic page" block and verifies its consistency in the database.
       */
      public function testBlockContentCreation() {
        // Add a new view mode and verify if it is selected as expected.
        $this->drupalLogin($this->drupalCreateUser(array('administer display modes')));
        $this->drupalGet('admin/structure/display-modes/view/add/block_content');
        $edit = array(
          'id' => 'test_view_mode',
          'label' => 'Test View Mode',
        );
        $this->drupalPostForm(NULL, $edit, t('Save'));
        $this->assertRaw(t('Saved the %label view mode.', array('%label' => $edit['label'])));
    
        $this->drupalLogin($this->adminUser);
    
        // Create a block.
        $edit = array();
        $edit['info[0][value]'] = 'Test Block';
        $edit['body[0][value]'] = $this->randomMachineName(16);
        $this->drupalPostForm('block/add/basic', $edit, t('Save'));
    
        // Check that the Basic block has been created.
        $this->assertRaw(format_string('!block %name has been created.', array(
          '!block' => 'basic',
          '%name' => $edit['info[0][value]']
        )), 'Basic block created.');
    
        // Change the view mode.
        $view_mode['settings[view_mode]'] = 'test_view_mode';
        $this->drupalPostForm(NULL, $view_mode, t('Save block'));
    
        // Go to the configure page and verify that the new view mode is correct.