public function ProfileTypeTest::testAdd in Profile 8
Tests adding a profile type.
File
- tests/
src/ Functional/ ProfileTypeTest.php, line 34
Class
- ProfileTypeTest
- Tests the profile type UI.
Namespace
Drupal\Tests\profile\FunctionalCode
public function testAdd() {
$this
->drupalGet('admin/config/people/profile-types/add');
$edit = [
'id' => 'customer',
'label' => 'Customer',
'display_label' => 'Customer information',
'registration' => TRUE,
'allow_revisions' => TRUE,
'new_revision' => TRUE,
];
$this
->submitForm($edit, 'Save');
$this
->assertSession()
->pageTextContains('Saved the Customer profile type.');
$profile_type = ProfileType::load($edit['id']);
$this
->assertNotEmpty($profile_type);
$this
->assertEquals('Customer', $profile_type
->label());
$this
->assertEquals('Customer information', $profile_type
->getDisplayLabel());
$this
->assertTrue($profile_type
->getRegistration());
$this
->assertTrue($profile_type
->allowsRevisions());
$this
->assertTrue($profile_type
->shouldCreateNewRevision());
}