Completed
Push — master ( a7939e...84054a )
by Alessandro
03:27
created

ProcessFactoryTest::testCreateProcess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 16
rs 9.4285
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
3
namespace Paraunit\Tests\Unit\Process;
4
5
use Paraunit\Configuration\PHPUnitBinFile;
6
use Paraunit\Configuration\PHPUnitConfigFile;
7
use Paraunit\Process\ParaunitProcessAbstract;
8
use Paraunit\Process\ProcessFactory;
9
10
/**
11
 * Class ProcessFactoryTest
12
 * @package Paraunit\Tests\Unit\Process
13
 */
14
class ProcessFactoryTest extends \PHPUnit_Framework_TestCase
15
{
16
    public function testCreateProcess()
17
    {
18
        $phpUnitBin = $this->prophesize('Paraunit\Configuration\PHPUnitBinFile');
19
        $phpUnitBin->getPhpUnitBin()->shouldBeCalled()->willReturn('phpunit');
20
21
        $phpUnitConfigFile = $this->prophesize('Paraunit\Configuration\PHPUnitConfigFile');
22
        $phpUnitConfigFile->getFileFullPath()->shouldBeCalled()->willReturn('configFile.xml');
23
24
        $factory = new ProcessFactory($phpUnitBin->reveal());
25
        $factory->setConfigFile($phpUnitConfigFile->reveal());
26
27
        $process = $factory->createProcess("TestTest.php");
28
29
        $this->assertInstanceOf('Paraunit\Process\ParaunitProcessAbstract', $process);
30
        $this->assertEquals('phpunit -c configFile.xml --colors=never TestTest.php 2>&1', $process->getCommandLine());
31
    }
32
33
    public function testCreateProcessThrowsExceptionIfConfigIsMissing()
34
    {
35
        $phpUnitBin = $this->prophesize('Paraunit\Configuration\PHPUnitBinFile');
36
37
        $factory = new ProcessFactory($phpUnitBin->reveal());
38
39
        $this->setExpectedException('\Exception', 'config missing');
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

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

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

Loading history...
40
        $factory->createProcess('test');
41
    }
42
}
43