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

AbstractTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 6
c 0
b 0
f 0
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A mockDispatcherInContainer() 0 6 1
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