diff --git a/tests/forms/GridFieldSortableRowsAutoSortTest.php b/tests/forms/GridFieldSortableRowsAutoSortTest.php index 267f055..cd94596 100644 --- a/tests/forms/GridFieldSortableRowsAutoSortTest.php +++ b/tests/forms/GridFieldSortableRowsAutoSortTest.php @@ -16,7 +16,7 @@ class GridFieldSortableRowsAutoSortTest extends SapphireTest { $stateID = 'testGridStateActionField'; Session::set($stateID, array('grid'=>'', 'actionName'=>'sortableRowsToggle', 'args'=>array('GridFieldSortableRows'=>array('sortableToggle'=>true)))); - $request = new SS_HTTPRequest('POST', 'url', array(), array('action_gridFieldAlterAction?StateID='.$stateID=>true)); + $request = new SS_HTTPRequest('POST', 'url', array(), array('action_gridFieldAlterAction?StateID='.$stateID=>true, $form->getSecurityToken()->getName()=>$form->getSecurityToken()->getValue())); $gridField->gridFieldAlterAction(array('StateID'=>$stateID), $form, $request); //Insure sort ran @@ -43,7 +43,7 @@ class GridFieldSortableRowsAutoSortTest extends SapphireTest { $stateID = 'testGridStateActionField'; Session::set($stateID, array('grid'=>'', 'actionName'=>'sortableRowsToggle', 'args'=>array('GridFieldSortableRows'=>array('sortableToggle'=>true)))); - $request = new SS_HTTPRequest('POST', 'url', array(), array('action_gridFieldAlterAction?StateID='.$stateID=>true)); + $request = new SS_HTTPRequest('POST', 'url', array(), array('action_gridFieldAlterAction?StateID='.$stateID=>true, $form->getSecurityToken()->getName()=>$form->getSecurityToken()->getValue())); $gridField->gridFieldAlterAction(array('StateID'=>$stateID), $form, $request); //Insure sort ran @@ -76,7 +76,7 @@ class GridFieldSortableRowsAutoSortTest extends SapphireTest { $stateID = 'testGridStateActionField'; Session::set($stateID, array('grid'=>'', 'actionName'=>'sortableRowsToggle', 'args'=>array('GridFieldSortableRows'=>array('sortableToggle'=>true)))); - $request = new SS_HTTPRequest('POST', 'url', array(), array('action_gridFieldAlterAction?StateID='.$stateID=>true)); + $request = new SS_HTTPRequest('POST', 'url', array(), array('action_gridFieldAlterAction?StateID='.$stateID=>true, $form->getSecurityToken()->getName()=>$form->getSecurityToken()->getValue())); $gridField->gridFieldAlterAction(array('StateID'=>$stateID), $form, $request); @@ -131,7 +131,7 @@ class GridFieldSortableRowsAutoSortTest extends SapphireTest { $stateID = 'testGridStateActionField'; Session::set($stateID, array('grid'=>'', 'actionName'=>'sortableRowsToggle', 'args'=>array('GridFieldSortableRows'=>array('sortableToggle'=>true)))); - $request = new SS_HTTPRequest('POST', 'url', array(), array('action_gridFieldAlterAction?StateID='.$stateID=>true)); + $request = new SS_HTTPRequest('POST', 'url', array(), array('action_gridFieldAlterAction?StateID='.$stateID=>true, $form->getSecurityToken()->getName()=>$form->getSecurityToken()->getValue())); $gridField->gridFieldAlterAction(array('StateID'=>$stateID), $form, $request); diff --git a/tests/forms/GridFieldSortableRowsPageTest.php b/tests/forms/GridFieldSortableRowsPageTest.php index 9402036..c5c92e7 100644 --- a/tests/forms/GridFieldSortableRowsPageTest.php +++ b/tests/forms/GridFieldSortableRowsPageTest.php @@ -33,7 +33,7 @@ class GridFieldSortableRowsPageTest extends SapphireTest { $this->logInWithPermission('ADMIN'); $stateID = 'testGridStateActionField'; Session::set($stateID, array('grid'=>'', 'actionName'=>'sortToPage', 'args'=>array('GridFieldSortableRows'=>array('sortableToggle'=>true), 'GridFieldPaginator'=>array('currentPage'=>1)))); - $request = new SS_HTTPRequest('POST', 'url', array('ItemID'=>$team3->ID, 'Target'=>'nextpage'), array('action_gridFieldAlterAction?StateID='.$stateID=>true)); + $request = new SS_HTTPRequest('POST', 'url', array('ItemID'=>$team3->ID, 'Target'=>'nextpage'), array('action_gridFieldAlterAction?StateID='.$stateID=>true, $this->form->getSecurityToken()->getName()=>$this->form->getSecurityToken()->getValue())); $this->gridField->gridFieldAlterAction(array('StateID'=>$stateID), $this->form, $request); @@ -53,7 +53,7 @@ class GridFieldSortableRowsPageTest extends SapphireTest { $this->logInWithPermission('ADMIN'); $stateID = 'testGridStateActionField'; Session::set($stateID, array('grid'=>'', 'actionName'=>'sortToPage', 'args'=>array('GridFieldSortableRows'=>array('sortableToggle'=>true), 'GridFieldPaginator'=>array('currentPage'=>1)))); - $request = new SS_HTTPRequest('POST', 'url', array('ItemID'=>$team7->ID, 'Target'=>'previouspage'), array('action_gridFieldAlterAction?StateID='.$stateID=>true)); + $request = new SS_HTTPRequest('POST', 'url', array('ItemID'=>$team7->ID, 'Target'=>'previouspage'), array('action_gridFieldAlterAction?StateID='.$stateID=>true, $this->form->getSecurityToken()->getName()=>$this->form->getSecurityToken()->getValue())); $this->gridField->gridFieldAlterAction(array('StateID'=>$stateID), $this->form, $request); @@ -84,7 +84,7 @@ class GridFieldSortableRowsPageTest extends SapphireTest { $this->logInWithPermission('ADMIN'); $stateID = 'testGridStateActionField'; Session::set($stateID, array('grid'=>'', 'actionName'=>'sortToPage', 'args'=>array('GridFieldSortableRows'=>array('sortableToggle'=>true), 'GridFieldPaginator'=>array('currentPage'=>1)))); - $request = new SS_HTTPRequest('POST', 'url', array('ItemID'=>$team3->ID, 'Target'=>'nextpage'), array('action_gridFieldAlterAction?StateID='.$stateID=>true)); + $request = new SS_HTTPRequest('POST', 'url', array('ItemID'=>$team3->ID, 'Target'=>'nextpage'), array('action_gridFieldAlterAction?StateID='.$stateID=>true, $this->form->getSecurityToken()->getName()=>$this->form->getSecurityToken()->getValue())); $this->gridField->gridFieldAlterAction(array('StateID'=>$stateID), $this->form, $request); @@ -124,7 +124,7 @@ class GridFieldSortableRowsPageTest extends SapphireTest { $this->logInWithPermission('ADMIN'); $stateID = 'testGridStateActionField'; Session::set($stateID, array('grid'=>'', 'actionName'=>'sortToPage', 'args'=>array('GridFieldSortableRows'=>array('sortableToggle'=>true), 'GridFieldPaginator'=>array('currentPage'=>1)))); - $request = new SS_HTTPRequest('POST', 'url', array('ItemID'=>$team7->ID, 'Target'=>'previouspage'), array('action_gridFieldAlterAction?StateID='.$stateID=>true)); + $request = new SS_HTTPRequest('POST', 'url', array('ItemID'=>$team7->ID, 'Target'=>'previouspage'), array('action_gridFieldAlterAction?StateID='.$stateID=>true, $this->form->getSecurityToken()->getName()=>$this->form->getSecurityToken()->getValue())); $this->gridField->gridFieldAlterAction(array('StateID'=>$stateID), $this->form, $request); diff --git a/tests/forms/GridFieldSortableRowsTest.php b/tests/forms/GridFieldSortableRowsTest.php index b4a447e..76a6c55 100644 --- a/tests/forms/GridFieldSortableRowsTest.php +++ b/tests/forms/GridFieldSortableRowsTest.php @@ -33,7 +33,7 @@ class GridFieldSortableRowsTest extends SapphireTest { $stateID = 'testGridStateActionField'; Session::set($stateID, array('grid'=>'', 'actionName'=>'saveGridRowSort', 'args'=>array('GridFieldSortableRows'=>array('sortableToggle'=>true)))); - $request = new SS_HTTPRequest('POST', 'url', array('ItemIDs'=>"$team1->ID, $team3->ID, $team2->ID"), array('action_gridFieldAlterAction?StateID='.$stateID=>true)); + $request = new SS_HTTPRequest('POST', 'url', array('ItemIDs'=>"$team1->ID, $team3->ID, $team2->ID"), array('action_gridFieldAlterAction?StateID='.$stateID=>true, $this->form->getSecurityToken()->getName()=>$this->form->getSecurityToken()->getValue())); $this->gridField->gridFieldAlterAction(array('StateID'=>$stateID), $this->form, $request); $this->assertEquals($team3->ID, $this->list->last()->ID, 'User should\'t be able to sort records without correct permissions.'); } @@ -45,7 +45,7 @@ class GridFieldSortableRowsTest extends SapphireTest { $this->logInWithPermission('ADMIN'); $stateID = 'testGridStateActionField'; Session::set($stateID, array('grid'=>'', 'actionName'=>'saveGridRowSort', 'args'=>array('GridFieldSortableRows'=>array('sortableToggle'=>true)))); - $request = new SS_HTTPRequest('POST', 'url', array('ItemIDs'=>"$team1->ID, $team3->ID, $team2->ID"), array('action_gridFieldAlterAction?StateID='.$stateID=>true)); + $request = new SS_HTTPRequest('POST', 'url', array('ItemIDs'=>"$team1->ID, $team3->ID, $team2->ID"), array('action_gridFieldAlterAction?StateID='.$stateID=>true, $this->form->getSecurityToken()->getName()=>$this->form->getSecurityToken()->getValue())); $this->gridField->gridFieldAlterAction(array('StateID'=>$stateID), $this->form, $request); $this->assertEquals($team2->ID, $this->list->last()->ID, 'User should be able to sort records with ADMIN permission.'); } @@ -70,7 +70,7 @@ class GridFieldSortableRowsTest extends SapphireTest { $this->logInWithPermission('ADMIN'); $stateID = 'testGridStateActionField'; Session::set($stateID, array('grid'=>'', 'actionName'=>'saveGridRowSort', 'args'=>array('GridFieldSortableRows'=>array('sortableToggle'=>true)))); - $request = new SS_HTTPRequest('POST', 'url', array('ItemIDs'=>"$team1->ID, $team3->ID, $team2->ID"), array('action_gridFieldAlterAction?StateID='.$stateID=>true)); + $request = new SS_HTTPRequest('POST', 'url', array('ItemIDs'=>"$team1->ID, $team3->ID, $team2->ID"), array('action_gridFieldAlterAction?StateID='.$stateID=>true, $this->form->getSecurityToken()->getName()=>$this->form->getSecurityToken()->getValue())); $this->gridField->gridFieldAlterAction(array('StateID'=>$stateID), $this->form, $request); $this->assertEquals($team2->ID, $list->last()->ID, 'Sort should have happened on Versioned stage "Stage"');