Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->document = new Document();
     $this->document->setId(1);
     $this->document->setDocument('This is the document');
     $project = new Project();
     $project->setNumber('1234');
     $this->document->setProject($project);
     $contentType = new ContentType();
     $contentType->setExtension('.xyz');
     $this->document->setContentType($contentType);
     $authorizeServiceMock = $this->getMockBuilder('BjyAuthorize\\View\\Helper\\IsAllowed')->disableOriginalConstructor()->getMock();
     $authorizeServiceMock->expects($this->any())->method('__invoke')->will($this->returnValue(true));
     $viewHelperManager = $this->serviceManager->get('viewhelpermanager');
     $viewHelperManager->setService('isAllowed', $authorizeServiceMock);
     $urlViewHelperMock = $this->getMockBuilder(Url::class)->disableOriginalConstructor()->getMock();
     $urlViewHelperMock->expects($this->any())->method('__invoke')->will($this->returnValue(true));
     $viewHelperManager->setService('url', $urlViewHelperMock);
     $this->documentLink = $this->serviceManager->get('viewhelpermanager')->get('documentlink');
 }
Exemplo n.º 2
0
 public function provider()
 {
     $projectTest = new ProjectTest();
     $contactTest = new ContactTest();
     $documentTypeTest = new TypeTest();
     $contentTypeTest = new ContentTypeTest();
     $document = new Document();
     $document->setDocument('This is a test-document');
     $document->setType(10000);
     $document->setContentType($contentTypeTest->provider()[0][0]);
     $document->setContact($contactTest->provider()[0][0]);
     $document->setProject($projectTest->provider()[0][0]);
     $document->setType($documentTypeTest->provider()[0][0]);
     return [[$document]];
 }
Exemplo n.º 3
0
 /**
  * Load the Document
  *
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $document = new Document();
     $document->setContentType($manager->find("General\\Entity\\ContentType", 2));
     $document->setSize(1000);
     $document->setDocument('This is the testdocument for the merge');
     $document->setContact($manager->find("Contact\\Entity\\Contact", 1));
     $document->setProject($manager->find("Project\\Entity\\Project", 1));
     $document->setType($manager->find("Project\\Entity\\Document\\Type", 1));
     $documentObject = new Object();
     $documentObject->setObject(file_get_contents(__DIR__ . '/../../assets/doc/ITEA3_PO_Annex_template_Call1.docx'));
     $documentObject->setDocument($document);
     $manager->persist($documentObject);
     $manager->flush();
 }