FacetsBlockTest.php in Facets Block 8
File
tests/src/Functional/FacetsBlockTest.php
View source
<?php
namespace Drupal\Tests\facets_block\Functional;
use Drupal\Tests\block\Traits\BlockCreationTrait;
use Drupal\Tests\BrowserTestBase;
class FacetsBlockTest extends BrowserTestBase {
use BlockCreationTrait;
public static $modules = [
'block',
'facets_block',
];
protected $defaultTheme = 'stark';
protected function setUp() {
parent::setUp();
$admin_user = $this
->drupalCreateUser([
'administer blocks',
'administer site configuration',
'access administration pages',
]);
$this
->drupalLogin($admin_user);
}
public function testBlockAvailability() {
$this
->drupalGet('/admin/structure/block');
$this
->clickLink('Place block');
$this
->assertSession()
->pageTextContains('Facets Block');
$this
->assertSession()
->linkByHrefExists('admin/structure/block/add/facets_block/', 0);
}
public function testBlockPlacement() {
$this
->drupalPlaceBlock('facets_block', [
'region' => 'content',
'label' => 'Facets Block',
'id' => 'facetsblock',
]);
$this
->drupalGet('admin/structure/block');
$this
->assertSession()
->pageTextContains('Facets Block');
$this
->drupalGet('<front>');
$this
->assertSession()
->pageTextContains('Facets Block');
}
}