Example #1
0
 /**
  * @test
  */
 public function executeRemoteCommandRespectsRemoteCommandExecutionHandler()
 {
     $shellCommandService = new \TYPO3\Surf\Domain\Service\ShellCommandService();
     $node = new \TYPO3\Surf\Domain\Model\Node('TestNode');
     $node->setHostname('asdf');
     $arguments = array();
     $node->setOption('remoteCommandExecutionHandler', function (\TYPO3\Surf\Domain\Service\ShellCommandService $shellCommandService, $command, \TYPO3\Surf\Domain\Model\Node $node, \TYPO3\Surf\Domain\Model\Deployment $deployment, $logOutput) use(&$arguments) {
         $arguments = func_get_args();
         return array(0, 'Hello World');
     });
     $deployment = new \TYPO3\Surf\Domain\Model\Deployment('TestDeployment');
     $mockLogger = $this->getMock('Psr\\Log\\LoggerInterface');
     /** @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject $mockLogger */
     $deployment->setLogger($mockLogger);
     $response = $shellCommandService->execute('foo command', $node, $deployment);
     $this->assertEquals('Hello World', $response);
     $this->assertSame(array($shellCommandService, 'foo command', $node, $deployment, true), $arguments);
 }
Example #2
0
<?php

/**
 * VOP deployment
 * Created by Markus Sommer (markussom@posteo.de)
 */
use TYPO3\Surf\Task\LocalShellTask;
use TYPO3\Surf\Task\Package\GitTask;
use TYPO3\Surf\Task\ShellTask;
if (!isset($settings)) {
    die('Keine Einstellungen gefunden');
}
$node = new TYPO3\Surf\Domain\Model\Node($settings['project']['instance']);
$node->setHostname($settings['server']['hostname']);
$node->setOption('username', $settings['server']['username']);
$application = new \TYPO3\Surf\Application\TYPO3\CMS($settings['project']['name']);
$application->setOption('projectName', $settings['project']['name']);
$application->setOption('repositoryUrl', $settings['project']['repository']);
$application->setOption('branch', $settings['project']['branch']);
$application->setOption('baseUrl', $settings['project']['url']);
$application->setOption('transferMethod', 'rsync');
$application->setOption('packageMethod', 'git');
$application->setDeploymentPath($settings['server']['path']);
$application->setOption('composerCommandPath', 'composer');
$application->setOption('keepReleases', 0);
$application->setOption('phpBinaryPathAndFilename', '/usr/local/bin/php5-56STABLE-CLI');
$application->setSymlinks($settings['symlinks']);
$application->addNode($node);
// WORKFLOW
$workflow = new \TYPO3\Surf\Domain\Model\SimpleWorkflow();
$workflow->afterTask(GitTask::class, 'Markussom\\Vop\\DefinedTask\\LocalShell\\MoveWeb');