ShareThisBlockAdminTest.php in Sharethis block 8
File
tests/src/Functional/ShareThisBlockAdminTest.php
View source
<?php
namespace Drupal\Tests\sharethis_block\Functional;
use Behat\Mink\Exception\ExpectationException;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\Tests\BrowserTestBase;
class ShareThisBlockAdminTest extends BrowserTestBase {
public static $modules = [
'sharethis_block',
];
protected $profile = 'minimal';
protected $defaultTheme = 'stark';
protected static $userPermissions = [
'access content',
'administer sharethis_block',
];
protected function setUp() {
parent::setUp();
$account = $this
->drupalCreateUser(static::$userPermissions);
$this
->drupalLogin($account);
}
public function testAccessAdminPage() {
$this
->drupalGet('/admin/config/user-interface/sharethis');
$this
->assertSession()
->statusCodeEquals(200);
}
public function testSaveForm() {
$this
->drupalGet('/admin/config/user-interface/sharethis');
$this
->assertSession()
->fieldValueEquals('property_id', '');
$this
->getSession()
->getPage()
->fillField('property_id', '5ece0df09d73fe001243be34');
$this
->getSession()
->getPage()
->selectFieldOption('inline', '1');
$this
->getSession()
->getPage()
->pressButton('Save configuration');
$this
->drupalGet('/admin/config/user-interface/sharethis');
$this
->assertSession()
->fieldValueEquals('inline', '1');
$this
->assertSession()
->fieldValueEquals('property_id', '5ece0df09d73fe001243be34');
}
}