alert = m::mock(AlertsMessageBag::class); $this->configRepository = m::mock(ConfigRepository::class); $this->encrypter = m::mock(Encrypter::class); $this->kernel = m::mock(Kernel::class); $this->settingsRepositoryInterface = m::mock(SettingsRepositoryInterface::class); } /** * Test the mail controller for viewing mail settings page. */ public function testIndex() { $this->configRepository->shouldReceive('get'); $response = $this->getController()->index(); $this->assertIsViewResponse($response); $this->assertViewNameEquals('admin.settings.mail', $response); } /** * Prepare a MailController using our mocks. * * @return MailController */ public function getController() { return new MailController( $this->alert, $this->configRepository, $this->encrypter, $this->kernel, $this->settingsRepositoryInterface ); } }