Example #1
0
	/**
	 * Handles the request
	 *
	 * @return \TYPO3\CMS\Extbase\Mvc\ResponseInterface
	 */
	public function handleRequest() {
		$commandLine = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
		$callingScript = array_shift($commandLine);
		if ($callingScript !== $_SERVER['_']) {
			$callingScript = $_SERVER['_'] . ' ' . $callingScript;
		}
		$request = $this->requestBuilder->build($commandLine, $callingScript . ' extbase');
		/** @var $response \TYPO3\CMS\Extbase\Mvc\Cli\Response */
		$response = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Cli\Response::class);
		$this->dispatcher->dispatch($request, $response);
		$response->send();
		return $response;
	}
 /**
  * @test
  * @author Robert Lemke <*****@*****.**>
  */
 public function booleanOptionsCanHaveOnlyCertainValuesIfTheValueIsAssignedWithoutEqualSign()
 {
     $methodParameters = array('b1' => array('optional' => TRUE, 'type' => 'boolean'), 'b2' => array('optional' => TRUE, 'type' => 'boolean'), 'b3' => array('optional' => TRUE, 'type' => 'boolean'), 'b4' => array('optional' => TRUE, 'type' => 'boolean'), 'b5' => array('optional' => TRUE, 'type' => 'boolean'), 'b6' => array('optional' => TRUE, 'type' => 'boolean'));
     $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with('Tx_SomeExtensionName_Command_DefaultCommandController', 'listCommand')->will($this->returnValue($methodParameters));
     $expectedArguments = array('b1' => TRUE, 'b2' => TRUE, 'b3' => TRUE, 'b4' => FALSE, 'b5' => FALSE, 'b6' => FALSE);
     $request = $this->requestBuilder->build('some_extension_name:default:list --b2 y --b1 1 --b3 true --b4 false --b5 n --b6 0');
     $this->assertEquals($expectedArguments, $request->getArguments());
 }