PluginTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 12 1
A testGetPackages() 0 4 1
A testGetSubscribedEvents() 0 4 1
1
<?php
2
3
/*
4
 * Composer plugin for pluggable extensions
5
 *
6
 * @link      https://github.com/hiqdev/composer-extension-plugin
7
 * @package   composer-extension-plugin
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hiqdev\composerextensionplugin\tests\unit;
13
14
use Composer\Composer;
15
use Composer\Config;
16
use hiqdev\composerextensionplugin\Plugin;
17
18
/**
19
 * Class PluginTest.
20
 */
21
class PluginTest extends \PHPUnit_Framework_TestCase
22
{
23
    private $object;
24
    private $io;
25
    private $composer;
26
    private $event;
27
    private $packages = [];
28
29
    public function setUp()
30
    {
31
        parent::setUp();
32
        $this->composer = new Composer();
33
        $this->composer->setConfig(new Config(true, getcwd()));
34
        $this->io = $this->getMock('Composer\IO\IOInterface');
35
        $this->event = $this->getMock('Composer\Script\Event', [], ['test', $this->composer, $this->io]);
36
37
        $this->object = new Plugin();
38
        $this->object->setPackages($this->packages);
39
        $this->object->activate($this->composer, $this->io);
40
    }
41
42
    public function testGetPackages()
43
    {
44
        $this->assertSame($this->packages, $this->object->getPackages());
45
    }
46
47
    public function testGetSubscribedEvents()
48
    {
49
        $this->assertInternalType('array', $this->object->getSubscribedEvents());
50
    }
51
}
52