Passed
Push — master ( e140d0...d9458c )
by Gabriel
12:38
created

AbstractTest::mockDispatcherInContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace ByTIC\EventDispatcher\Tests;
4
5
use ByTIC\EventDispatcher\Dispatcher\EventDispatcher;
6
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
7
use Nip\Container\Utility\Container;
8
use PHPUnit\Framework\TestCase;
9
10
/**
11
 * Class AbstractTest
12
 */
13
abstract class AbstractTest extends TestCase
14
{
15
    use MockeryPHPUnitIntegration;
16
17
    protected $object;
18
19
    /**
20
     * @return \Mockery\Mock|EventDispatcher
21
     */
22
    protected function mockDispatcherInContainer()
23
    {
24
        $dispatcher = \Mockery::mock(EventDispatcher::class)->shouldAllowMockingProtectedMethods()->makePartial();
25
        Container::container()->set('events', $dispatcher);
0 ignored issues
show
Bug introduced by
The method set() does not exist on Psr\Container\ContainerInterface. It seems like you code against a sub-type of Psr\Container\ContainerInterface such as Symfony\Component\Depend...tion\ContainerInterface or Nip\Container\ContainerInterface or Symfony\Component\Depend...rameterBag\ContainerBag or Nip\Container\Bridges\LeagueContainer or Nip\Container\Bridges\LaravelContainer. ( Ignorable by Annotation )

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

25
        Container::container()->/** @scrutinizer ignore-call */ set('events', $dispatcher);
Loading history...
26
27
        return $dispatcher;
28
    }
29
}
30