TwitterBlockTest.php in Twitter Block 8.2        
                          
                  
                        
  
  
  
  
  
File
  src/Tests/TwitterBlockTest.php
  
    View source  
  <?php
namespace Drupal\twitter_block\Tests;
use Drupal\simpletest\WebTestBase;
class TwitterBlockTest extends WebTestBase {
  
  public static $modules = [
    'system_test',
    'block',
    'twitter_block',
  ];
  
  protected function setUp() {
    parent::setUp();
    
    $admin_user = $this
      ->drupalCreateUser(array(
      'administer blocks',
      'administer site configuration',
      'access administration pages',
    ));
    $this
      ->drupalLogin($admin_user);
  }
  
  public function testTwitterBlock() {
    
    \Drupal::service('theme_handler')
      ->install([
      'bartik',
      'seven',
      'stark',
    ]);
    $theme_settings = $this
      ->config('system.theme');
    foreach ([
      'bartik',
      'seven',
      'stark',
    ] as $theme) {
      $this
        ->drupalGet('admin/structure/block/list/' . $theme);
      
      $this
        ->drupalPlaceBlock('twitter_block', array(
        'widget_id' => 600720083413962752,
        'width' => 180,
        'height' => 200,
        'region' => 'content',
        'theme' => $theme,
      ));
      
      $theme_settings
        ->set('default', $theme)
        ->save();
      $this
        ->drupalGet('');
      $this
        ->assertText('Twitter feed', 'Twitter block found');
    }
  }
}