TYPO3 CMS  TYPO3_6-2
UploadExtensionFileControllerTest.php
Go to the documentation of this file.
1 <?php
3 
22 
27  return array(
28  'simple' => array(
29  'extension_0.0.0.zip',
30  'extension'
31  ),
32  'underscore in extension name' => array(
33  'extension_key_10.100.356.zip',
34  'extension_key'
35  ),
36  'camel case file name' => array(
37  'extensionName_1.1.1.zip',
38  'extensionname'
39  ),
40  'version with dashes' => array(
41  'extension_1-2-3.zip',
42  'extension'
43  ),
44  'characters after version' => array(
45  'extension_1-2-3(1).zip',
46  'extension'
47  ),
48  'characters after version with extra space' => array(
49  'extension_1-2-3 (1).zip',
50  'extension'
51  ),
52  'no version' => array(
53  'extension.zip',
54  'extension'
55  )
56  );
57  }
65  public function getExtensionFromZipFileExtractsExtensionKey($filename, $expectedKey) {
66  $fixture = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Controller\\UploadExtensionFileController', array('dummy'));
67  $managementServiceMock = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Service\\ExtensionManagementService', array('isAvailable'), array(), '', FALSE);
68  $managementServiceMock->expects($this->once())
69  ->method('isAvailable')
70  ->with($expectedKey)
71  ->will($this->returnValue(FALSE));
72  $fixture->_set('managementService', $managementServiceMock);
73  $fileHandlingUtilityMock = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\FileHandlingUtility');
74  $fileHandlingUtilityMock->expects($this->once())->method('unzipExtensionFromFile');
75  $fixture->_set('fileHandlingUtility', $fileHandlingUtilityMock);
76 
77  $extensionDetails = $fixture->_call('getExtensionFromZipFile', '', $filename);
78  $this->assertEquals($expectedKey, $extensionDetails['extKey']);
79  }
80 
81 }
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)