Completed
Push — master ( 2308db...df4497 )
by Massimiliano
03:56
created

BowerphpTestCase::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Bowerphp\Test;
4
5
use Mockery;
6
use PHPUnit\Framework\TestCase;
7
use ReflectionClass;
8
9
abstract class BowerphpTestCase extends TestCase
10
{
11
    /**
12
     * @param \Mockery\MockInterface
13
     */
14
    protected $filesystem;
15
16
    /**
17
     * XXX this is indeed a GithubClient, it should be renamed here and in all tests
18
     *
19
     * @param \Mockery\MockInterface
20
     */
21
    protected $httpClient;
22
23
    protected function setUp()
24
    {
25
        $this->filesystem = Mockery::mock('Bowerphp\Util\Filesystem');
26
        $this->httpClient = Mockery::mock('Github\Client');
27
    }
28
29
    protected function tearDown()
30
    {
31
        // this is to make Mockery assertion count as PHPUnit assertion, avoiding "risky"
32
        if (!is_null($container = Mockery::getContainer())) {
33
            $this->addToAssertionCount($container->mockery_getExpectationCount());
34
        }
35
        Mockery::close();
36
    }
37
38
    /**
39
     * @param  string           $class
40
     * @param  string           $name
41
     * @return ReflectionMethod
42
     */
43
    protected function getMethod($class, $name)
44
    {
45
        $class = new ReflectionClass($class);
46
        $method = $class->getMethod($name);
47
        $method->setAccessible(true);
48
49
        return $method;
50
    }
51
}
52