public function TeamInvitationsTest::testMultipleInvitations in Apigee Edge 8
Tests that an email can be invited to one or more teams.
File
- modules/
apigee_edge_teams/ tests/ src/ Functional/ TeamInvitationsTest.php, line 148
Class
- TeamInvitationsTest
- Team invitation test.
Namespace
Drupal\Tests\apigee_edge_teams\FunctionalCode
public function testMultipleInvitations() {
$this
->drupalLogin($this->accountAdmin);
$teams = [
$this->teamA,
$this->teamB,
];
$companies = [
$this->teamA
->decorated(),
$this->teamB
->decorated(),
];
$inCache = FALSE;
foreach ($teams as $team) {
if (!$inCache) {
$this
->queueCompanyResponse($team
->decorated());
}
$this
->drupalGet(Url::fromRoute('entity.team.add_members', [
'team' => $team
->id(),
]));
$this
->assertSession()
->pageTextContains('Invite members');
$this
->queueDevsInCompanyResponse([]);
$this
->queueCompaniesResponse($companies);
$this
->queueCompaniesResponse($companies);
$this
->submitForm([
'developers' => $this->accountUser
->getEmail(),
], 'Invite members');
$successMessage = t('The following developer has been invited to the @team @team_label: @developer.', [
'@developer' => $this->accountUser
->getEmail(),
'@team' => $team
->label(),
'@team_label' => mb_strtolower($team
->getEntityType()
->getSingularLabel()),
]);
$this
->assertSession()
->pageTextContains($successMessage);
$inCache = TRUE;
}
}