/** * @test */ public function hiddenFieldsContainDataOfAPreviouslyUploadedResource() { $mockResource = $this->getMock('TYPO3\\Flow\\Resource\\Resource'); $mockResource->expects($this->any())->method('getFilename')->will($this->returnValue('theResourceFilename')); $mockResource->expects($this->any())->method('getResourcePointer')->will($this->returnValue('theResourcePointer')); $resourceData = array('error' => \UPLOAD_ERR_NO_FILE, 'submittedFile' => array('filename' => 'theResourceFilename', 'resourcePointer' => 'theResourcePointer')); $this->mockPropertyMapper->expects($this->atLeastOnce())->method('convert')->with($resourceData, 'TYPO3\\Flow\\Resource\\Resource')->will($this->returnValue($mockResource)); $this->viewHelper->expects($this->atLeastOnce())->method('getValue')->will($this->returnValue($resourceData)); $expectedResult = '<input type="hidden" name="[submittedFile][filename]" value="theResourceFilename" /><input type="hidden" name="[submittedFile][resourcePointer]" value="theResourcePointer" />'; $this->viewHelper->initialize(); $actualResult = $this->viewHelper->render(); $this->assertSame($expectedResult, $actualResult); }
/** * @test */ public function renderCallsSetErrorClassAttribute() { $this->viewHelper->expects($this->once())->method('setErrorClassAttribute'); $this->viewHelper->render(); }