Completed
Branch 6.0 (d30585)
by yun
02:10
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
<?php
2
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 */
14
    protected $app;
15
16
    /** @var Config|MockInterface */
17
    protected $config;
18
19
    protected function prepareApp()
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