/** * @test */ public function convertFromReturnsAnErrorIfTheUploadedFileCantBeImported() { $source = array('tmp_name' => 'SomeFilename', 'error' => \UPLOAD_ERR_OK); $this->mockResourceManager->expects($this->once())->method('importUploadedResource')->with($source)->will($this->returnValue(FALSE)); $actualResult = $this->resourceTypeConverter->convertFrom($source, 'TYPO3\\Flow\\Resource\\Resource'); $this->assertInstanceOf('TYPO3\\Flow\\Error\\Error', $actualResult); }
/** * @test */ public function convertFromReturnsAnErrorIfTheUploadedFileCantBeImported() { $this->inject($this->resourceTypeConverter, 'systemLogger', $this->createMock(\TYPO3\Flow\Log\SystemLoggerInterface::class)); $source = array('tmp_name' => 'SomeFilename', 'error' => \UPLOAD_ERR_OK); $this->mockResourceManager->expects($this->once())->method('importUploadedResource')->with($source)->will($this->throwException(new \TYPO3\Flow\Resource\Exception())); $actualResult = $this->resourceTypeConverter->convertFrom($source, \TYPO3\Flow\Resource\Resource::class); $this->assertInstanceOf(\TYPO3\Flow\Error\Error::class, $actualResult); }