|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Step to set a routing in a Cloud Foundry instance. |
|
4
|
|
|
*/ |
|
5
|
|
|
|
|
6
|
|
|
namespace Graviton\Deployment\Tests\Steps\CloudFoundry; |
|
7
|
|
|
|
|
8
|
|
|
use Graviton\Deployment\DeployScriptsTestCase; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* @author List of contributors <https://github.com/libgraviton/deploy-scripts/graphs/contributors> |
|
12
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License |
|
13
|
|
|
* @link http://swisscom.ch |
|
14
|
|
|
*/ |
|
15
|
|
|
class CommonStepTest extends DeployScriptsTestCase |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* Validate getCommand |
|
19
|
|
|
* |
|
20
|
|
|
* @dataProvider stepCredentialsProvider |
|
21
|
|
|
* |
|
22
|
|
|
* @param string $cmd Name of the step. |
|
23
|
|
|
* @param array $args List of argumetns to be used to initialize the step. |
|
24
|
|
|
* @param array $expected Expected data set to be passed |
|
25
|
|
|
* to a ProcessBuilder. |
|
26
|
|
|
* |
|
27
|
|
|
* @return void |
|
28
|
|
|
*/ |
|
29
|
|
|
public function testGetCommand($cmd, array $args, $expected) |
|
30
|
|
|
{ |
|
31
|
|
|
$reflector = new \ReflectionClass($cmd); |
|
32
|
|
|
$step = $reflector->newInstanceArgs($args); |
|
33
|
|
|
$this->assertEquals($expected, $step->getCommand()); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @return array |
|
38
|
|
|
*/ |
|
39
|
|
|
public function stepCredentialsProvider() |
|
40
|
|
|
{ |
|
41
|
|
|
$configuration = DeployScriptsTestCase::getConfigurationSet(); |
|
42
|
|
|
|
|
43
|
|
|
return array( |
|
44
|
|
|
'step route' => array( |
|
45
|
|
|
'\Graviton\Deployment\Steps\CloudFoundry\StepRoute', |
|
46
|
|
|
array($configuration, 'APP_NAME', 'target', 'ROUTE', 'map'), |
|
47
|
|
|
array('/usr/bin/cf', 'map-route', 'target', 'DOMAIN', '-n', 'ROUTE') |
|
48
|
|
|
), |
|
49
|
|
|
'step create service' => array( |
|
50
|
|
|
'\Graviton\Deployment\Steps\CloudFoundry\StepCreateService', |
|
51
|
|
|
array($configuration, 'my_application', 'mongodb', 'mongotype'), |
|
52
|
|
|
array('/usr/bin/cf', 'cs', 'mongodb', 'mongotype', 'my_application-mongodb') |
|
53
|
|
|
), |
|
54
|
|
|
); |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|