QuickFormTest.php in farmOS 2.x
File
modules/core/quick/tests/src/Functional/QuickFormTest.php
View source
<?php
namespace Drupal\Tests\farm_quick\Functional;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Tests\farm_test\Functional\FarmBrowserTestBase;
class QuickFormTest extends FarmBrowserTestBase {
use StringTranslationTrait;
protected static $modules = [
'farm_quick_test',
];
public function testQuickForms() {
$user = $this
->createUser();
$this
->drupalLogin($user);
$this
->drupalGet('quick');
$this
->assertSession()
->statusCodeEquals(403);
$user = $this
->createUser([
'view quick forms index',
]);
$this
->drupalLogin($user);
$this
->drupalGet('quick');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains($this
->t('You do not have any quick forms.'));
$user = $this
->createUser([
'view quick forms index',
'create test log',
]);
$this
->drupalLogin($user);
$this
->drupalGet('quick');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains($this
->t('Test quick form'));
$this
->drupalGet('quick/test');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains($this
->t('Test field'));
}
}