public function testValid() { $doc = new DocInFold(); $doc->setDocumentId(1); $doc->setFirstPage(1); $doc->setLastPage(5); $page = new PageInDoc(); $page->setPageOptionId(1); $page->setNumber(1); $doc->addPage($page); $stapling = new Stapling(); $stapling->setFirstPageOffset(1); $stapling->setLastPageOffset(3); $doc->addStaplingDetails($stapling); $stapling = new Stapling(); $stapling->setFirstPageOffset(4); $doc->addStaplingDetails($stapling); $doc->verify(); }
protected function getValidRequest() { $request = new Request(); $request->setMediaType(Request::PAPER); $request->setTrackId('234'); //RECIPIENTS $recipient1 = RecipientTest::getValidRecipient(0); $recipient2 = RecipientTest::getValidRecipient(1); $request->addRecipient($recipient1); $request->addRecipient($recipient2); //DOCUMENTS $document1 = DocumentTest::getValidDocument(0); $document2 = DocumentTest::getValidDocument(1); $request->addDocumentData($document1); $request->addDocumentData($document2); //FOLDS $fold = new Fold(); $fold->setTrackId('xsx'); $fold->setId('1'); $fold->setRecipientId($recipient1->getId()); #Doc $docInFold = new DocInFold(); $docInFold->setDocumentId($document1->getId()); $docInFold->setFirstPage(2); $pageInDoc = new PageInDoc(); $pageInDoc->setNumber(2); $pageInDoc->setPageOptionId('134'); $docInFold->addPage($pageInDoc); $stapling = new Stapling(); $stapling->setFirstPageOffset(1); $stapling->setLastPageOffset(3); $docInFold->addStaplingDetails($stapling); $fold->addDocument($docInFold); $docInFold = new DocInFold(); $docInFold->setDocumentId($document2->getId()); $fold->addDocument($docInFold); $request->addFold($fold); //OPTION $option = new Option(); #request $optionPaper = new Option\Request\Paper(); $optionPaper->setRemoveInvalidReturnEnvelope(true); $optionPaper->setStampAdjust(true); $optionRequest = new Option\Request(); $optionRequest->setPaperOption($optionPaper); $option->setRequestOption($optionRequest); #document $optionPaperPage = new Option\Page\Paper(); $optionPaperPage->setBackgroundId(1); $insertId = new Option\Page\InsertPageId(); $insertId->setValue('134'); $insertId->setType(Option\Page\InsertPageId::INSERTPAGEID_TYPE_RV); $optionPaperPage->setInsertPageId($insertId); $optionPaper = new Option\Document\Paper(); $optionPaper->setPageOption($optionPaperPage); $optionPaper->setStaple(true); $optionDocument = new Option\Document(); $optionDocument->setPaperOption($optionPaper); $optionDocument->setId(1); $option->addDocumentOptions($optionDocument); #page $optionPage = new Option\Page(); $optionPage->setPaperOption($optionPaperPage); $optionPage->setId(1); $option->addPageOptions($optionPage); $request->setOptions($option); return $request; }