Passed
Push — 6.0 ( e94667...0f4cab )
by yun
07:08
created

InteractsWithApp   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 18
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A prepareApp() 0 10 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace think\tests;
4
5
use Mockery as m;
6
use Mockery\MockInterface;
7
use think\App;
8
use think\Config;
9
use think\Container;
10
11
trait InteractsWithApp
12
{
13
    /** @var App|MockInterface */
0 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
14
    protected $app;
15
16
    /** @var Config|MockInterface */
0 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
17
    protected $config;
18
19
    protected function prepareApp()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function prepareApp()
Loading history...
20
    {
21
        $this->app = m::mock(App::class)->makePartial();
22
        Container::setInstance($this->app);
23
        $this->app->shouldReceive('make')->with(App::class)->andReturn($this->app);
24
        $this->app->shouldReceive('isDebug')->andReturnTrue();
25
        $this->config = m::mock(Config::class)->makePartial();
26
        $this->config->shouldReceive('get')->with('app.show_error_msg')->andReturnTrue();
27
        $this->app->shouldReceive('get')->with('config')->andReturn($this->config);
28
        $this->app->shouldReceive('runningInConsole')->andReturn(false);
29
    }
30
}
31