protected function mockLang($locale = "en") { Illuminate\Support\Facades\Lang::swap($lang = m::mock('LangMock')); $lang->shouldReceive('setLocale'); $lang->shouldReceive('locale')->andReturn($locale); foreach ($this->testMessages[$locale] as $key => $message) { $lang->shouldReceive('get')->with($key)->andReturn($message); $lang->shouldReceive('get')->with($key, m::any(), $locale)->andReturn($message); } }
public function _before() { Illuminate\Support\Facades\Config::shouldReceive('get')->with('reloquent.pagination.per_page', m::any())->andReturn(15); Illuminate\Support\Facades\Config::shouldReceive('get')->with('reloquent.limit', m::any())->andReturn(20); Illuminate\Support\Facades\Config::shouldReceive('get')->with('reloquent.debug', m::any())->andReturn(false); Illuminate\Support\Facades\Lang::shouldReceive('get')->with(m::any(), m::any())->andReturn(''); $this->model = m::mock('\\TestModel'); $this->validator = m::mock('Illuminate\\Validation\\Factory'); $this->app = m::mock('Illuminate\\Container\\Container'); $this->app->shouldReceive('make')->with($this->modelCls)->andReturn($this->model); $this->app->shouldReceive('make')->with('validator')->andReturn($this->validator); $this->repository = new TestRepository($this->app); //m::mock(new TestRepository($this->app))->makePartial(); }