25 public function getCommandControllerActionFieldFetchesCorrectClassNames() {
28 $command1 = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', array(), array(),
'', FALSE);
29 $command1->expects($this->once())->method(
'isInternal')->will($this->returnValue(FALSE));
30 $command1->expects($this->once())->method(
'getControllerClassName')->will($this->returnValue(
'TYPO3\\CMS\\Extbase\\Tests\\MockACommandController'));
31 $command1->expects($this->once())->method(
'getControllerCommandName')->will($this->returnValue(
'FuncA'));
32 $command1->expects($this->once())->method(
'getCommandIdentifier')->will($this->returnValue(
'extbase:mocka:funca'));
35 $command2 = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', array(), array(),
'', FALSE);
36 $command2->expects($this->once())->method(
'isInternal')->will($this->returnValue(FALSE));
37 $command2->expects($this->once())->method(
'getControllerClassName')->will($this->returnValue(
'Acme\\Mypkg\\Command\\MockBCommandController'));
38 $command2->expects($this->once())->method(
'getControllerCommandName')->will($this->returnValue(
'FuncB'));
39 $command2->expects($this->once())->method(
'getCommandIdentifier')->will($this->returnValue(
'mypkg:mockb:funcb'));
42 $command3 = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', array(), array(),
'', FALSE);
43 $command3->expects($this->once())->method(
'isInternal')->will($this->returnValue(FALSE));
44 $command3->expects($this->once())->method(
'getControllerClassName')->will($this->returnValue(
'Tx_Extbase_Command_MockCCommandController'));
45 $command3->expects($this->once())->method(
'getControllerCommandName')->will($this->returnValue(
'FuncC'));
46 $command3->expects($this->once())->method(
'getCommandIdentifier')->will($this->returnValue(
'extbase:mockc:funcc'));
49 $commandManager = $this->getMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\CommandManager', array(
'getAvailableCommands'));
50 $commandManager->expects($this->any())->method(
'getAvailableCommands')->will($this->returnValue(array($command1, $command2, $command3)));
54 '\TYPO3\CMS\Extbase\Scheduler\FieldProvider',
55 array(
'getActionLabel'),
60 $fieldProvider->_set(
'commandManager', $commandManager);
61 $fieldProvider->expects($this->once())->method(
'getActionLabel')->will($this->returnValue(
'some label'));
62 $actualResult = $fieldProvider->_call(
'getCommandControllerActionField', array());
63 $this->assertContains(
'<option title="test" value="extbase:mocka:funca">Extbase MockA: FuncA</option>', $actualResult[
'code']);
64 $this->assertContains(
'<option title="test" value="mypkg:mockb:funcb">Mypkg MockB: FuncB</option>', $actualResult[
'code']);
65 $this->assertContains(
'<option title="test" value="extbase:mockc:funcc">Extbase MockC: FuncC</option>', $actualResult[
'code']);
74 eval(
'namespace ' . __NAMESPACE__ .
'; class ' . $className .
' extends \\TYPO3\\CMS\\Extbase\\Mvc\\Controller\\AbstractController { function getExtensionName() { return $this->extensionName; } }');
75 $classNameNamespaced = __NAMESPACE__ .
'\\' . $className;
76 $mockController =
new $classNameNamespaced();
77 $expectedResult =
'Extbase';
78 $actualResult = $mockController->getExtensionName();
79 $this->assertSame($expectedResult, $actualResult);
86 public function validateAdditionalFieldsReturnsTrue() {
89 '\TYPO3\CMS\Extbase\Scheduler\FieldProvider',
95 $submittedData = array();
97 $schedulerModule = $this->getMock(
'TYPO3\\CMS\\Scheduler\\Controller\\SchedulerModuleController', array(), array(),
'', FALSE);
98 $this->assertTrue($fieldProvider->validateAdditionalFields($submittedData, $schedulerModule));
105 public function getAdditionalFieldsRendersRightHtml() {
106 $this->markTestSkipped(
'Incomplete mocking in a complex scenario. This should be a functional test');
109 $command1 = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', array(), array(),
'', FALSE);
110 $command1->expects($this->once())->method(
'isInternal')->will($this->returnValue(FALSE));
111 $command1->expects($this->once())->method(
'getControllerClassName')->will($this->returnValue(
'TYPO3\\CMS\\Extbase\\Tests\\MockACommandController'));
112 $command1->expects($this->once())->method(
'getControllerCommandName')->will($this->returnValue(
'FuncA'));
113 $command1->expects($this->any())->method(
'getCommandIdentifier')->will($this->returnValue(
'extbase:mocka:funca'));
114 $command1->expects($this->once())->method(
'getArgumentDefinitions')->will($this->returnValue(array()));
117 $command2 = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', array(), array(),
'', FALSE);
118 $command2->expects($this->once())->method(
'isInternal')->will($this->returnValue(FALSE));
119 $command2->expects($this->once())->method(
'getControllerClassName')->will($this->returnValue(
'Acme\\Mypkg\\Command\\MockBCommandController'));
120 $command2->expects($this->once())->method(
'getControllerCommandName')->will($this->returnValue(
'FuncB'));
121 $command2->expects($this->any())->method(
'getCommandIdentifier')->will($this->returnValue(
'mypkg:mockb:funcb'));
124 $command3 = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', array(), array(),
'', FALSE);
125 $command3->expects($this->once())->method(
'isInternal')->will($this->returnValue(FALSE));
126 $command3->expects($this->once())->method(
'getControllerClassName')->will($this->returnValue(
'Tx_Extbase_Command_MockCCommandController'));
127 $command3->expects($this->once())->method(
'getControllerCommandName')->will($this->returnValue(
'FuncC'));
128 $command3->expects($this->any())->method(
'getCommandIdentifier')->will($this->returnValue(
'extbase:mockc:funcc'));
131 $commandManager = $this->getMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\CommandManager', array(
'getAvailableCommands'));
132 $commandManager->expects($this->any())->method(
'getAvailableCommands')->will($this->returnValue(array($command1, $command2, $command3)));
136 '\TYPO3\CMS\Extbase\Scheduler\FieldProvider',
137 array(
'getActionLabel',
'getArgumentLabel',
'getCommandControllerActionArgumentFields'),
142 $fieldProvider->_set(
'commandManager', $commandManager);
143 $actionLabel =
'action label string';
144 $argumentLabel =
'argument label string';
145 $fieldProvider->expects($this->any())->method(
'getActionLabel')->will($this->returnValue($actionLabel));
146 $fieldProvider->expects($this->any())->method(
'getArgumentLabel')->will($this->returnValue($argumentLabel));
147 $argArray[
'arg'] = array(
148 'code' =>
'<input type="text" name="tx_scheduler[task_extbase][arguments][arg]" value="1" /> ',
149 'label' => $argumentLabel
151 $fieldProvider->expects($this->any())->method(
'getCommandControllerActionArgumentFields')->will($this->returnValue($argArray));
152 $expectedAdditionalFields = array(
154 'code' =>
'<select name="tx_scheduler[task_extbase][action]">' . LF
155 .
'<option title="test" value="extbase:mocka:funca" selected="selected">Extbase MockA: FuncA</option>' . LF
156 .
'<option title="test" value="mypkg:mockb:funcb">Mypkg MockB: FuncB</option>' . LF
157 .
'<option title="test" value="extbase:mockc:funcc">Extbase MockC: FuncC</option>' . LF
159 'label' => $actionLabel
161 'description' => array(
163 'label' =>
'<strong></strong>' 166 'code' =>
'<input type="text" name="tx_scheduler[task_extbase][arguments][arg]" value="1" /> ',
167 'label' => $argumentLabel
173 $task = new \TYPO3\CMS\Extbase\Scheduler\Task();
174 $task->setCommandIdentifier($command1->getCommandIdentifier());
176 $schedulerModule = $this->getMock(
'TYPO3\\CMS\\Scheduler\\Controller\\SchedulerModuleController', array(), array(),
'', FALSE);
178 $this->assertEquals($expectedAdditionalFields, $fieldProvider->getAdditionalFields($taskInfo, $task, $schedulerModule));
constructResolvesExtensionnameFromNamespaced()
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)