From c8ac013b65dd0b9b9a9ecea9b4ec0053c3f7ce47 Mon Sep 17 00:00:00 2001 From: ayan4m1 Date: Sat, 15 Sep 2018 23:18:19 -0400 Subject: [PATCH] add simple MailControllerTest (index only) --- .../Controllers/Admin/MailControllerTest.php | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 tests/Unit/Http/Controllers/Admin/MailControllerTest.php diff --git a/tests/Unit/Http/Controllers/Admin/MailControllerTest.php b/tests/Unit/Http/Controllers/Admin/MailControllerTest.php new file mode 100644 index 000000000..e99fe392e --- /dev/null +++ b/tests/Unit/Http/Controllers/Admin/MailControllerTest.php @@ -0,0 +1,82 @@ +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 + ); + } +}