Completed
Push — master ( 97fa09...70bd5d )
by Tim
02:27
created

ApplicationTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 51
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetContainer() 0 3 1
A setUp() 0 24 1
1
<?php
2
3
/**
4
 * TechDivision\Import\Cli\ApplicationTest
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2016 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/techdivision/import-cli-simple
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Cli;
22
23
use TechDivision\Import\Cli\Application;
24
use TechDivision\Import\Cli\Utils\DependencyInjectionKeys;
25
26
/**
27
 * Test class for the symfony application implementation.
28
 *
29
 * @author    Tim Wagner <[email protected]>
30
 * @copyright 2016 TechDivision GmbH <[email protected]>
31
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
32
 * @link      https://github.com/techdivision/import-cli-simple
33
 * @link      http://www.techdivision.com
34
 */
35
class ApplicationTest extends \PHPUnit_Framework_TestCase
36
{
37
38
    /**
39
     * The application that has to be tested.
40
     *
41
     * @var \TechDivision\Import\Cli\Application
42
     */
43
    protected $application;
44
45
    /**
46
     * Sets up the fixture, for example, open a network connection.
47
     * This method is called before a test is executed.
48
     *
49
     * @return void
50
     * @see \PHPUnit_Framework_TestCase::setUp()
51
     */
52
    protected function setUp()
53
    {
54
55
        // mock the container instance
56
        $mockContainer = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')
57
                              ->setMethods(get_class_methods('Symfony\Component\DependencyInjection\ContainerInterface'))
58
                              ->getMock();
59
60
        // mock the methods
61
        $mockContainer->expects($this->any())
62
                      ->method('getParameter')
63
                      ->withConsecutive(
64
                          array(DependencyInjectionKeys::CONFIGURATION_VENDOR_DIR),
65
                          array(DependencyInjectionKeys::APPLICATION_VERSION_FILE),
66
                          array(DependencyInjectionKeys::APPLICATION_NAME)
67
                      )
68
                      ->willReturnOnConsecutiveCalls(
69
                          __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'vendor',
70
                          '.semver',
71
                          'Test Tool'
72
                      );
73
74
        // create an instance of the application
75
        $this->application = new Application($mockContainer);
76
    }
77
78
    /**
79
     * Test the getContainer() method.
80
     *
81
     * @return void
82
     */
83
    public function testGetContainer()
84
    {
85
        $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerInterface', $this->application->getContainer());
86
    }
87
}
88