StepDeleteTest::provide()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
rs 9.6666
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
/**
3
 * Test suite for the delete step.
4
 */
5
6
namespace Graviton\Deployment\Tests\Steps\CloudFoundry;
7
8
use Graviton\Deployment\DeployScriptsTestCase;
9
use Graviton\Deployment\Steps\CloudFoundry\StepDelete;
10
11
/**
12
 * @author   List of contributors <https://github.com/libgraviton/deploy-scripts/graphs/contributors>
13
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
14
 * @link     http://swisscom.ch
15
 */
16
class StepDeleteTest extends DeployScriptsTestCase
17
{
18
    /**
19
     * Validate getCommand
20
     *
21
     * @dataProvider provide
22
     *
23
     * @param bool  $force     Flag to force a deletion or not.
24
     * @param bool  $delMapped Flag to force a deletion of routes mapped by the or not.
25
     * @param array $flags     Flags representing the two parameters for the cf delete command.
26
     *
27
     * @return void
28
     */
29
    public function testGetCommand($force, $delMapped, array $flags)
30
    {
31
        $step = new StepDelete($this->getConfigurationSet(), 'my_application', 'blue', $force, $delMapped);
32
33
        $this->assertEquals(
34
            array_merge(array('/usr/bin/cf', 'delete', 'my_application-blue'), $flags),
35
            $step->getCommand()
36
        );
37
    }
38
39
    /**
40
     * @return array
41
     */
42
    public function provide()
43
    {
44
        return array(
45
            'deletemapped routes' => array(false, true, array('-r')),
46
            'force delete' => array(true, false, array('-f')),
47
            'no force delete' => array(false, false, array()),
48
            'force delete and delete all mapped routes' => array(true, true, array('-f', '-r')),
49
        );
50
    }
51
}
52