GroupTest.php in farmOS 2.x
File
modules/asset/group/tests/src/Functional/GroupTest.php
View source
<?php
namespace Drupal\Tests\farm_group\Functional;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\log\Entity\Log;
class GroupTest extends WebDriverTestBase {
protected $profile = 'farm';
protected $defaultTheme = 'stark';
protected static $modules = [
'farm_group',
'farm_group_test',
];
protected function setUp() : void {
$GLOBALS['farm_test'] = TRUE;
parent::setUp();
$user = $this
->createUser([
'administer log',
]);
$this
->drupalLogin($user);
}
public function testGroupFieldVisibility() {
$log = Log::create([
'type' => 'test',
]);
$log
->save();
$this
->drupalGet('log/' . $log
->id() . '/edit');
$page = $this
->getSession()
->getPage();
$group_field = $page
->findById('edit-group-wrapper');
$this
->assertNotEmpty($group_field);
$this
->assertFalse($group_field
->isVisible());
$log->is_group_assignment = TRUE;
$log
->save();
$this
->drupalGet('log/' . $log
->id() . '/edit');
$page = $this
->getSession()
->getPage();
$group_field = $page
->findById('edit-group-wrapper');
$this
->assertNotEmpty($group_field);
$this
->assertTrue($group_field
->isVisible());
}
}
Classes
Name |
Description |
GroupTest |
Tests for farmOS group membership logic. |