Completed
Push — master ( 1b8ca6...90d75c )
by Mahmoud
03:54
created

TestsMockHelperTrait::mock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace App\Ship\Features\Tests\PhpUnit;
4
5
use App;
6
use Mockery;
7
8
/**
9
 * Class TestsMockHelperTrait
10
 *
11
 * Tests helper for mocking objects and services.
12
 *
13
 * @author  Mahmoud Zalt  <[email protected]>
14
 */
15
trait TestsMockHelperTrait
16
{
17
18
    /**
19
     * Mocking helper
20
     *
21
     * @param $class
22
     *
23
     * @return  \Mockery\MockInterface
24
     */
25
    public function mock($class)
26
    {
27
        $mock = Mockery::mock($class);
28
        App::instance($class, $mock);
29
30
        return $mock;
31
    }
32
}
33