ApplicationTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

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

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
 * PHP version 7
7
 *
8
 * @author    Tim Wagner <[email protected]>
9
 * @copyright 2016 TechDivision GmbH <[email protected]>
10
 * @license   https://opensource.org/licenses/MIT
11
 * @link      https://github.com/techdivision/import-cli-simple
12
 * @link      http://www.techdivision.com
13
 */
14
15
namespace TechDivision\Import\Cli;
16
17
use PHPUnit\Framework\TestCase;
18
use TechDivision\Import\Cli\Utils\DependencyInjectionKeys;
19
20
/**
21
 * Test class for the symfony application implementation.
22
 *
23
 * @author    Tim Wagner <[email protected]>
24
 * @copyright 2016 TechDivision GmbH <[email protected]>
25
 * @license   https://opensource.org/licenses/MIT
26
 * @link      https://github.com/techdivision/import-cli-simple
27
 * @link      http://www.techdivision.com
28
 */
29
class ApplicationTest extends TestCase
30
{
31
32
    /**
33
     * The application that has to be tested.
34
     *
35
     * @var \TechDivision\Import\Cli\Application
36
     */
37
    protected $application;
38
39
    /**
40
     * Sets up the fixture, for example, open a network connection.
41
     * This method is called before a test is executed.
42
     *
43
     * @return void
44
     * @see \PHPUnit\Framework\TestCase::setUp()
45
     */
46
    protected function setUp(): void
47
    {
48
49
        // mock the container instance
50
        $mockContainer = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\MockOb...ckBuilder::setMethods() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

50
        $mockContainer = /** @scrutinizer ignore-deprecated */ $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
51
                              ->setMethods(get_class_methods('Symfony\Component\DependencyInjection\ContainerInterface'))
52
                              ->getMock();
53
54
        // mock the methods
55
        $mockContainer->expects($this->any())
56
                      ->method('getParameter')
57
                      ->withConsecutive(
58
                          array(DependencyInjectionKeys::CONFIGURATION_BASE_DIR),
59
                          array(DependencyInjectionKeys::APPLICATION_VERSION_FILE),
60
                          array(DependencyInjectionKeys::APPLICATION_NAME)
61
                      )
62
                      ->willReturnOnConsecutiveCalls(
63
                          __DIR__ . DIRECTORY_SEPARATOR . '_files',
64
                          '.semver',
65
                          'Test Tool'
66
                      );
67
68
        // create an instance of the application
69
        $this->application = new Application($mockContainer);
70
    }
71
72
    /**
73
     * Test the getContainer() method.
74
     *
75
     * @return void
76
     */
77
    public function testGetContainer()
78
    {
79
        $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerInterface', $this->application->getContainer());
80
    }
81
}
82