From d2cae6bd00a38126931b02574e80e29490a30875 Mon Sep 17 00:00:00 2001 From: thangnn Date: Tue, 23 Apr 2024 10:40:58 +0700 Subject: [PATCH] add unitTest_BcMailServiceProvider_services --- .../ServiceProvider/BcMailServiceProvider.php | 1 + .../BcMailServiceProviderTest.php | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 plugins/bc-mail/tests/TestCase/ServiceProvider/BcMailServiceProviderTest.php diff --git a/plugins/bc-mail/src/ServiceProvider/BcMailServiceProvider.php b/plugins/bc-mail/src/ServiceProvider/BcMailServiceProvider.php index 54a155799c..f43c44a7a7 100755 --- a/plugins/bc-mail/src/ServiceProvider/BcMailServiceProvider.php +++ b/plugins/bc-mail/src/ServiceProvider/BcMailServiceProvider.php @@ -58,6 +58,7 @@ class BcMailServiceProvider extends ServiceProvider * @param \Cake\Core\ContainerInterface $container * @checked * @noTodo + * @unitTest */ public function services($container): void { diff --git a/plugins/bc-mail/tests/TestCase/ServiceProvider/BcMailServiceProviderTest.php b/plugins/bc-mail/tests/TestCase/ServiceProvider/BcMailServiceProviderTest.php new file mode 100644 index 0000000000..5461213798 --- /dev/null +++ b/plugins/bc-mail/tests/TestCase/ServiceProvider/BcMailServiceProviderTest.php @@ -0,0 +1,44 @@ +Provider = new BcMailServiceProvider(); + } + + public function tearDown(): void + { + unset($this->Provider); + parent::tearDown(); + } + + public function testServices() + { + $container = new Container(); + $this->Provider->services($container); + $mailConfigsService = $container->get('BcMail\Service\MailConfigsServiceInterface'); + $this->assertEquals('BcMail\Service\MailConfigsService', get_class($mailConfigsService)); + $mailContentsService = $container->get('BcMail\Service\MailContentsServiceInterface'); + $this->assertEquals('BcMail\Service\MailContentsService', get_class($mailContentsService)); + $mailContentsAdminService = $container->get('BcMail\Service\Admin\MailContentsAdminServiceInterface'); + $this->assertEquals('BcMail\Service\Admin\MailContentsAdminService', get_class($mailContentsAdminService)); + $mailFieldsService = $container->get('BcMail\Service\MailFieldsServiceInterface'); + $this->assertEquals('BcMail\Service\MailFieldsService', get_class($mailFieldsService)); + $mailFieldsAdminService = $container->get('BcMail\Service\Admin\MailFieldsAdminServiceInterface'); + $this->assertEquals('BcMail\Service\Admin\MailFieldsAdminService', get_class($mailFieldsAdminService)); + $mailMessagesService = $container->get('BcMail\Service\MailMessagesServiceInterface'); + $this->assertEquals('BcMail\Service\MailMessagesService', get_class($mailMessagesService)); + $mailMessagesAdminService = $container->get('BcMail\Service\Admin\MailMessagesAdminServiceInterface'); + $this->assertEquals('BcMail\Service\Admin\MailMessagesAdminService', get_class($mailMessagesAdminService)); + $mailFrontService = $container->get('BcMail\Service\Front\MailFrontServiceInterface'); + $this->assertEquals('BcMail\Service\Front\MailFrontService', get_class($mailFrontService)); + } +} \ No newline at end of file