ResetMethodTest.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Security\Test\Unit\Model\Config\Source;
  8. use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
  9. /**
  10. * Test class for \Magento\Security\Model\Config\Source\ResetMethod testing
  11. */
  12. class ResetMethodTest extends \PHPUnit\Framework\TestCase
  13. {
  14. /**
  15. * @var \Magento\Security\Model\Config\Source\ResetMethod
  16. */
  17. protected $model;
  18. /**
  19. * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
  20. */
  21. protected $objectManager;
  22. /**
  23. * Init mocks for tests
  24. * @return void
  25. */
  26. protected function setUp()
  27. {
  28. $this->objectManager = new ObjectManager($this);
  29. $this->model = $this->objectManager->getObject(\Magento\Security\Model\Config\Source\ResetMethod::class);
  30. }
  31. public function testToOptionArray()
  32. {
  33. $expected = [
  34. [
  35. 'value' => \Magento\Security\Model\Config\Source\ResetMethod::OPTION_BY_IP_AND_EMAIL,
  36. 'label' => __('By IP and Email')
  37. ],
  38. [
  39. 'value' => \Magento\Security\Model\Config\Source\ResetMethod::OPTION_BY_IP,
  40. 'label' => __('By IP')
  41. ],
  42. [
  43. 'value' => \Magento\Security\Model\Config\Source\ResetMethod::OPTION_BY_EMAIL,
  44. 'label' => __('By Email')
  45. ],
  46. [
  47. 'value' => \Magento\Security\Model\Config\Source\ResetMethod::OPTION_NONE,
  48. 'label' => __('None')
  49. ],
  50. ];
  51. $this->assertEquals($expected, $this->model->toOptionArray());
  52. }
  53. public function testToArray()
  54. {
  55. $expected = [
  56. \Magento\Security\Model\Config\Source\ResetMethod::OPTION_BY_IP_AND_EMAIL => __('By IP and Email'),
  57. \Magento\Security\Model\Config\Source\ResetMethod::OPTION_BY_IP => __('By IP'),
  58. \Magento\Security\Model\Config\Source\ResetMethod::OPTION_BY_EMAIL => __('By Email'),
  59. \Magento\Security\Model\Config\Source\ResetMethod::OPTION_NONE => __('None'),
  60. ];
  61. $this->assertEquals($expected, $this->model->toArray());
  62. }
  63. }