28 $this->commandController = $this->
getAccessibleMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Controller\\CommandController', array(
'dummyCommand'));
35 $mockResponse = $this->getMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Response');
36 $mockResponse->expects($this->once())->method(
'appendContent')->with(
'some text');
37 $this->commandController->_set(
'response', $mockResponse);
38 $this->commandController->_call(
'output',
'some text');
45 $mockResponse = $this->getMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Response');
46 $mockResponse->expects($this->once())->method(
'appendContent')->with(
'some text');
47 $this->commandController->_set(
'response', $mockResponse);
48 $this->commandController->_call(
'output',
'%2$s %1$s', array(
'text',
'some'));
55 $mockResponse = $this->getMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Response');
56 $mockResponse->expects($this->once())->method(
'appendContent')->with(
'some text' . PHP_EOL);
57 $this->commandController->_set(
'response', $mockResponse);
58 $this->commandController->_call(
'outputLine',
'some text');
66 $mockResponse = $this->getMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Response');
67 $this->commandController->_set(
'response', $mockResponse);
68 $this->commandController->_call(
'quit');
76 $mockResponse = $this->getMock(
'TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Response');
77 $mockResponse->expects($this->once())->method(
'setExitCode')->with(123);
78 $this->commandController->_set(
'response', $mockResponse);
79 $this->commandController->_call(
'quit', 123);
86 $mockedUserAuthentication = $this->getMock(
'TYPO3\\CMS\\Core\\Authentication\\AbstractUserAuthentication');
87 $mockedUserAuthentication->user[
'admin'] = 42;
88 $this->commandController->expects($this->once())
89 ->method(
'dummyCommand')
91 $this->returnCallback(
92 function() use ($mockedUserAuthentication) {
93 if ($mockedUserAuthentication->user[
'admin'] !== 1) {
94 throw new \Exception(
'User role is not admin');
98 $this->commandController->_set(
'userAuthentication', $mockedUserAuthentication);
99 $this->commandController->_set(
'arguments', array());
100 $this->commandController->_set(
'commandMethodName',
'dummyCommand');
101 $this->commandController->_set(
'requestAdminPermissions', TRUE);
102 $this->commandController->_call(
'callCommandMethod');
104 $this->assertSame(42, $mockedUserAuthentication->user[
'admin']);
settingRequestAdminPropertySetsAdminRoleInUserAuthentication()
quitSetsResponseExitCode()
outputReplacesArgumentsInGivenString()
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
quitThrowsStopActionException()
outputLineAppendsGivenStringAndNewlineToTheResponseContent()
outputAppendsGivenStringToTheResponseContent()