public function testUpdateFromPredefined() { //TODO: see BB-1134 $this->markTestSkipped('Must be fixed in scope with BB-1134'); $currentUserRoles = $this->currentUser->getRoles(); $oldRoleId = $this->predefinedRole->getId(); $crawler = $this->client->request('GET', $this->getUrl('orob2b_account_frontend_account_user_role_update', ['id' => $oldRoleId])); $form = $crawler->selectButton('Save and Close')->form(); $token = $this->getContainer()->get('security.csrf.token_manager')->getToken('orob2b_account_frontend_account_user_role')->getValue(); $this->client->followRedirects(true); $crawler = $this->client->request($form->getMethod(), $form->getUri(), ['input_action' => '', 'orob2b_account_frontend_account_user_role' => ['_token' => $token, 'label' => self::CUSTOMIZED_ROLE, 'appendUsers' => $this->currentUser->getId()]]); $result = $this->client->getResponse(); $this->assertHtmlResponseStatusCodeEquals($result, 200); $content = $crawler->html(); $this->assertContains('Account User Role has been saved', $content); // Find id of new role $response = $this->requestFrontendGrid('frontend-account-account-user-roles-grid', ['frontend-account-account-user-roles-grid[_filter][label][value]' => self::CUSTOMIZED_ROLE]); $result = $this->getJsonResponseContent($response, 200); $result = reset($result['data']); $newRoleId = $result['id']; $this->assertNotEquals($newRoleId, $oldRoleId); /** @var \OroB2B\Bundle\AccountBundle\Entity\AccountUserRole $role */ $role = $this->getUserRoleRepository()->find($newRoleId); $this->assertNotNull($role); $this->assertEquals(self::CUSTOMIZED_ROLE, $role->getLabel()); $this->assertNotEmpty($role->getRole()); /** @var \OroB2B\Bundle\AccountBundle\Entity\AccountUser $user */ $user = $this->getCurrentUser(); // Add new role $this->assertCount(count($currentUserRoles) + 1, $user->getRoles()); $this->assertEquals($user->getRole($role->getRole()), $role); }