version 1.16.2 (#2942)
* bump version * include calendar week in week chooser * table names in SQL * show save flash message * prevent migration warning * drop default value to prevent error when server version is not set * csrf token for duplicate actions * updated translations
This commit is contained in:
@@ -216,7 +216,9 @@ class ProjectControllerTest extends ControllerBaseTest
|
||||
$em->persist($rate);
|
||||
$em->flush();
|
||||
|
||||
$this->request($client, '/admin/project/1/duplicate');
|
||||
$token = self::$container->get('security.csrf.token_manager')->getToken('project.duplicate');
|
||||
|
||||
$this->request($client, '/admin/project/1/duplicate/' . $token);
|
||||
$this->assertIsRedirect($client, '/details');
|
||||
$client->followRedirect();
|
||||
$node = $client->getCrawler()->filter('div.box#project_rates_box');
|
||||
@@ -226,6 +228,25 @@ class ProjectControllerTest extends ControllerBaseTest
|
||||
self::assertStringContainsString('123.45', $node->text(null, true));
|
||||
}
|
||||
|
||||
public function testDuplicateActionWithInvalidCsrf()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
/** @var EntityManager $em */
|
||||
$em = $this->getEntityManager();
|
||||
$project = $em->find(Project::class, 1);
|
||||
$project->setMetaField((new ProjectMeta())->setName('foo')->setValue('bar'));
|
||||
$project->setEnd(new \DateTime());
|
||||
$em->persist($project);
|
||||
$activity = new Activity();
|
||||
$activity->setName('blub');
|
||||
$activity->setProject($project);
|
||||
$activity->setMetaField((new ActivityMeta())->setName('blub')->setValue('blab'));
|
||||
$em->persist($activity);
|
||||
$em->flush();
|
||||
|
||||
$this->assertInvalidCsrfToken($client, '/admin/project/1/duplicate/rsetdzfukgli78t6r5uedtjfzkugl', $this->createUrl('/admin/project/1/details'));
|
||||
}
|
||||
|
||||
public function testAddCommentAction()
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
|
||||
Reference in New Issue
Block a user