public function testClearDocumentWoPerson()
 {
     $helper = new Review_Model_ClearDocumentsHelper();
     $helper->clear(array($this->documentId), 23);
     $document = new Opus_Document($this->documentId);
     $this->assertEquals('published', $document->getServerState());
     $this->assertEquals(0, count($document->getPersonReferee()));
     $enrichments = $document->getEnrichment();
     $this->assertEquals(1, count($enrichments));
     $this->assertEquals(23, $enrichments[0]->getValue());
 }
 /**
  * Action for showing the clear form and processing POST from it.
  */
 public function clearAction()
 {
     $ids = $this->_filterReviewableIds($this->_getParam('selected'));
     if (count($ids) < 1) {
         $this->view->message = 'review_error_noselection';
         return $this->render('message');
     }
     $this->view->selected = $ids;
     $this->view->documentCount = count($ids);
     $this->view->actionUrl = $this->view->url(array('action' => 'clear'));
     $useCurrentUser = false;
     $person = null;
     $config = $this->getConfig();
     if (isset($config, $config->clearing->addCurrentUserAsReferee)) {
         $useCurrentUser = $config->clearing->addCurrentUserAsReferee;
     }
     if ($useCurrentUser) {
         $person = $this->_loggedUser->createPerson();
         if (is_null($person) or !$person->isValid()) {
             $message = "Problem clearing documents.  Information for current user is incomplete or invalid.";
             $this->getLogger()->err($message);
             throw new Application_Exception($message);
         }
     }
     if ($this->_isButtonPressed('sureno', true, false)) {
         return $this->_forward('index', null, null, array('selected' => $ids));
     }
     if ($this->_isButtonPressed('sureyes', true, false)) {
         $helper = new Review_Model_ClearDocumentsHelper();
         $userId = $this->_loggedUser->getUserId();
         if (is_null($userId) or empty($userId)) {
             $userId = 'unknown';
         }
         $helper->clear($ids, $userId, $person);
         $this->view->message = 'review_accept_success';
         return $this->render('message');
     }
     $this->view->title = 'review_accept_title';
     $this->view->instruction = 'review_accept_instruction';
     $this->render('confirm');
 }