/**
  * Verschiebt eine CollectionRole einen Schritt nach oben oder unten.
  */
 public function moveAction()
 {
     try {
         $collectionRoleModel = new Admin_Model_CollectionRole($this->getRequest()->getParam('roleid', ''));
         $collectionRoleModel->move($this->getRequest()->getParam('pos'));
         return $this->_redirectTo('index', $this->view->translate('admin_collectionroles_move', $collectionRoleModel->getObject()->getName()));
     } catch (Application_Exception $e) {
         return $this->_redirectToAndExit('index', array('failure' => $e->getMessage()));
     }
 }
 public function testMove()
 {
     $colRole = new Opus_CollectionRole();
     $colRole->setName('MoveTestColRole-Name');
     $colRole->setOaiName('MoveTestColRole-OaiName');
     $colRole->setDisplayFrontdoor('Number');
     $colRole->setDisplayBrowsing('Name');
     $colRole->setPosition(100);
     $this->moveTestColId = $colRole->store();
     $colRoles = Opus_CollectionRole::fetchAll();
     $colRolesCount = count($colRoles);
     $this->assertEquals($this->moveTestColId, $colRoles[$colRolesCount - 1]->getId());
     $this->assertEquals($this->collectionRoleId, $colRoles[$colRolesCount - 2]->getId());
     $model = new Admin_Model_CollectionRole($this->collectionRoleId);
     $model->move(100);
     $colRoles = Opus_CollectionRole::fetchAll();
     $colRolesCount = count($colRoles);
     // Reihenfolge ist jetzt vertauscht
     $this->assertEquals($this->collectionRoleId, $colRoles[$colRolesCount - 1]->getId());
     $this->assertEquals($this->moveTestColId, $colRoles[$colRolesCount - 2]->getId());
 }