/** * @return array */ public function provider() { $dateTime = new \DateTime(); $dateStart = $dateTime->sub(new \DateInterval('P1Y')); $dateEnd = $dateTime->add(new \DateInterval('P4Y')); $dateTime = new \DateTime(); $dateStartActual = $dateTime->sub(new \DateInterval('P6M')); $dateEndActual = $dateTime->add(new \DateInterval('P3Y')); $contactTest = new ContactTest(); $callTest = new CallTest(); $project = new Project(); $project->setId(1); $project->setCall($callTest->provider()[0][0]); $project->setDateStart($dateStart); $project->setDateEnd($dateEnd); $project->setDateStartActual($dateStartActual); $project->setDateEndActual($dateEndActual); $project->setNumber(Rand::getString(4)); $project->setContact($contactTest->provider()[0][0]); $project->setSummary('This is the summary'); $project->setDescription('This is the description'); $workpackage = new Workpackage(); $workpackage->setId(1); return [[$project, $workpackage]]; }
/** * {@inheritDoc} */ public function setUp() { $this->serviceManager = Bootstrap::getServiceManager(); $this->document = new Document(); $this->document->setId(1); $this->document->setDocument('This is the document'); $contentType = new ContentType(); $contentType->setExtension('.xyz'); $this->document->setContentType($contentType); $project = new Project(); $project->setId(1); $project->setNumber('1234'); $project->setProject('This is the number'); $workpackage = new Workpackage(); $workpackage->setSequence(1); $workpackage->setProject($project); $this->document->setWorkpackage($workpackage); $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 = $viewHelperManager->get('workpackageDocumentlink'); }
/** * Produce a form element. * * @param Workpackage $workpackage * @param ProjectService $projectService */ public function __construct(Workpackage $workpackage, ProjectService $projectService) { parent::__construct($workpackage->getId()); foreach ($projectService->getAffiliation() as $affiliationService) { $affiliationFieldSet = new EffortPerAffiliationFieldset($affiliationService->getAffiliation(), $projectService); $this->add($affiliationFieldSet); } }