FBLikeboxBlockTest.php in Facebook Page Plugin 8.2
File
tests/src/Functional/FBLikeboxBlockTest.php
View source
<?php
namespace Drupal\Tests\fb_likebox\Functional;
use Drupal\Tests\BrowserTestBase;
class FBLikeboxBlockTest extends BrowserTestBase {
public static $modules = [
'system_test',
'block',
'fb_likebox',
];
protected function setUp() {
parent::setUp();
$admin_user = $this
->drupalCreateUser([
'administer blocks',
'administer site configuration',
'access administration pages',
]);
$this
->drupalLogin($admin_user);
}
public function testFBLikeboxBlock() {
\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('fb_likebox_block', [
'url' => 'https://www.facebook.com/FacebookDevelopers',
'title' => 'Iframe Title',
'width' => 180,
'height' => 70,
'language' => 'en_IN',
'region' => 'content',
'theme' => $theme,
]);
$theme_settings
->set('default', $theme)
->save();
$this
->drupalGet('');
$result = $this
->xpath('//div[@class=:class]', [
':class' => 'fb-page',
]);
$this
->assertEqual(count($result), 1, 'Facebook Likebox block found');
}
}
}