/** * @test */ public function toStringReturnsResourcePointerStringRepresentation() { $mockResourcePointer = $this->getMock('TYPO3\\FLOW3\\Resource\\ResourcePointer', array(), array(), '', FALSE); $mockResourcePointer->expects($this->atLeastOnce())->method('__toString')->will($this->returnValue('fakeSha1')); $resource = new \TYPO3\FLOW3\Resource\Resource(); $resource->setResourcePointer($mockResourcePointer); $this->assertEquals('fakeSha1', (string) $resource); }
/** * Creates a resource object from a given hash and filename. The according * resource pointer is fetched automatically. * * @param string $resourceHash * @param string $originalFilename * @return \TYPO3\FLOW3\Resource\Resource */ protected function createResourceFromHashAndFilename($resourceHash, $originalFilename) { $resource = new \TYPO3\FLOW3\Resource\Resource(); $resource->setFilename($originalFilename); $resourcePointer = $this->getResourcePointerForHash($resourceHash); $resource->setResourcePointer($resourcePointer); return $resource; }