Example #1
0
 /**
  * @test
  */
 public function executePassesNodeOptionsToTask()
 {
     $node = new \TYPO3\Surf\Domain\Model\Node('Test node');
     $application = new \TYPO3\Surf\Domain\Model\Application('Test application');
     $deployment = new \TYPO3\Surf\Domain\Model\Deployment('Test deployment');
     /** @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject $logger */
     $logger = $this->getMock('Psr\\Log\\LoggerInterface');
     $deployment->setLogger($logger);
     $task = $this->getMock('TYPO3\\Surf\\Domain\\Model\\Task');
     /** @var \TYPO3\Surf\Domain\Service\TaskManager|\PHPUnit_Framework_MockObject_MockObject $taskManager */
     $taskManager = $this->getMock('TYPO3\\Surf\\Domain\\Service\\TaskManager', array('createTaskInstance'));
     $taskManager->expects($this->any())->method('createTaskInstance')->with('MyVendor\\MyPackage\\Task\\TaskGroup\\MyTask')->will($this->returnValue($task));
     $nodeOptions = array('ssh[username]' => 'jdoe');
     $node->setOptions($nodeOptions);
     $task->expects($this->atLeastOnce())->method('execute')->with($this->anything(), $this->anything(), $this->anything(), $this->arrayHasKey('ssh[username]'));
     $localOptions = array();
     $taskManager->execute('MyVendor\\MyPackage\\Task\\TaskGroup\\MyTask', $node, $application, $deployment, 'test', $localOptions);
 }
Example #2
0
 /**
  * @test
  */
 public function executeOnLocalNodeJoinsCommandsWithAndOperator()
 {
     /** @var \TYPO3\Surf\Domain\Service\ShellCommandService|\PHPUnit_Framework_MockObject_MockObject $shellCommandService */
     $shellCommandService = $this->getMock('TYPO3\\Surf\\Domain\\Service\\ShellCommandService', array('executeProcess'));
     $node = new \TYPO3\Surf\Domain\Model\Node('TestNode');
     $node->setHostname('localhost');
     $deployment = new \TYPO3\Surf\Domain\Model\Deployment('TestDeployment');
     /** @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject $mockLogger */
     $mockLogger = $this->getMock('Psr\\Log\\LoggerInterface');
     $deployment->setLogger($mockLogger);
     $shellCommandService->expects($this->any())->method('executeProcess')->with($deployment, $this->stringContains('bin/false && ls -al'))->will($this->returnValue(array(0, 'Foo')));
     $response = $shellCommandService->execute(array('bin/false', 'ls -al'), $node, $deployment);
     $this->assertEquals('Foo', $response);
 }
Example #3
0
<?php

/** @var \TYPO3\Surf\Domain\Model\Deployment $deployment */
// APPLICATION
$application = new \TYPO3\Surf\CMS\Application\TYPO3\CMS();
$application->setOption('projectName', 'Introduction Package');
$application->setOption('repositoryUrl', 'git://git.typo3.org/TYPO3CMS/Distributions/Introduction.git');
$application->setOption('typo3.surf:gitCheckout[branch]', 'master');
$application->setDeploymentPath('/var/www/introduction');
// NODES
$node = new \TYPO3\Surf\Domain\Model\Node('Introduction Package on local system');
$node->setHostname('localhost');
$application->addNode($node);
// WORKFLOW
$workflow = new \TYPO3\Surf\Domain\Model\SimpleWorkflow();
// DEPLOYMENT
$deployment->setWorkflow($workflow);
$deployment->addApplication($application);
Example #4
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');