Example #1
0
 public function testAddInvalidDocument()
 {
     $mgr = new AfsDocumentManager();
     try {
         $mgr->add_document(new AfsDocument());
         $this->fail('Should have failed due to invalid document provided');
     } catch (InvalidArgumentException $e) {
     }
 }
Example #2
0
 /** @brief Upload one or more documents through document manager.
  *
  * @param $mgr [in] document manager (see @a AfsDocumentManager).
  * @param $comment [in] comment associated to this action (default=null).
  * @return command result (see @a AfsPafUploadReply).
  *
  * @exception InvalidArgumentException when no document is being sent.
  * @exception Exception when error occured while initializing or executing
  *            request.
  */
 public function upload_docs(AfsDocumentManager $mgr, $comment = null, $paf_mode = PaFMode::Incremental)
 {
     $this->paf_mode = $paf_mode;
     if (!$mgr->has_document()) {
         throw new InvalidArgumentException('No document to be sent');
     }
     $version = $this->get_bo_version();
     $context = new AfsPafConnectorContext($version, $mgr, $comment, $paf_mode);
     return new AfsPafUploadReply(json_decode($this->query($context)));
 }