Completed
Push — feature/EVO-5985-real-upload-c... ( f8846f...273dbd )
by
unknown
11:15
created

GenerateBundleCommandTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 2
cbo 4
dl 0
loc 73
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testInteractiveCommand() 0 4 1
A getCommand() 0 13 1
A getGenerator() 0 9 1
A getBundle() 0 10 1
1
<?php
2
/**
3
 * functional tests for graviton:generate:bundle
4
 */
5
6
namespace Graviton\GeneratorBundle\Tests\Command;
7
8
use Sensio\Bundle\GeneratorBundle\Tests\Command\GenerateBundleCommandTest as BaseTest;
9
use Graviton\GeneratorBundle\Command\GenerateBundleCommand;
10
11
/**
12
 * functional tests for graviton:generate:bundle
13
 *
14
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
15
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
16
 * @link     http://swisscom.ch
17
 *
18
 * @todo fix that updateKernel is not getting tested
19
 */
20
class GenerateBundleCommandTest extends BaseTest
21
{
22
    /**
23
     * test basic calls to command
24
     *
25
     * @param array  $options  options
26
     * @param string $input    cli input
27
     * @param array  $expected results to assert
28
     *
29
     * @return void
30
     *
31
     * @dataProvider getInteractiveCommandData
32
     */
33
    public function testInteractiveCommand($options, $input, $expected)
34
    {
35
        parent::testInteractiveCommand($options, $input, $expected);
36
    }
37
38
    /**
39
     * get command
40
     *
41
     * @param \Graviton\GeneratorBundle\Generator\BundleGenerator $generator generator
42
     * @param object                                              $input     input mock
43
     *
44
     * @return \Graviton\GeneratorBundle\Command\GenerateBundleCommand
45
     */
46
    protected function getCommand($generator, $input)
47
    {
48
        $command = $this
49
            ->getMockBuilder('Graviton\GeneratorBundle\Command\GenerateBundleCommand')
50
            ->setMethods(array('checkAutoloader', 'updateKernel'))
51
            ->getMock();
52
53
        $command->setContainer($this->getContainer());
54
        $command->setHelperSet($this->getHelperSet($input));
55
        $command->setGenerator($generator);
56
57
        return $command;
58
    }
59
60
    /**
61
     * get generator
62
     *
63
     * @return \Graviton\GeneratorBundle\Generator\BundleGenerator
64
     */
65
    protected function getGenerator()
66
    {
67
        // get a noop generator
68
        return $this
69
            ->getMockBuilder('Graviton\GeneratorBundle\Generator\BundleGenerator')
70
            ->disableOriginalConstructor()
71
            ->setMethods(['generate', 'generateBundle'])
72
            ->getMock();
73
    }
74
75
    /**
76
     * get bundle
77
     *
78
     * @return \Graviton\BundleBundle\GravitonBundleInterface
0 ignored issues
show
Documentation introduced by
Should the return type not be \PHPUnit_Framework_MockObject_MockObject?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
79
     *
80
     * @todo move one class up
81
     */
82
    protected function getBundle()
83
    {
84
        $bundle = $this->createMock('Graviton\BundleBundle\GravitonBundleBundle');
85
        $bundle
86
            ->expects($this->any())
87
            ->method('getPath')
88
            ->will($this->returnValue(sys_get_temp_dir()));
89
90
        return $bundle;
91
    }
92
}
93