SecurityTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Collection of various useful functions
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. /**
  9. * Test case for \Magento\Framework\Encryption\Security
  10. */
  11. namespace Magento\Framework\Encryption\Test\Unit\Helper;
  12. use Magento\Framework\Encryption\Helper\Security;
  13. class SecurityTest extends \PHPUnit\Framework\TestCase
  14. {
  15. /**
  16. * @var Security
  17. */
  18. protected $util;
  19. /**
  20. * @param string $expected
  21. * @param string $actual
  22. * @param bool $result
  23. * @dataProvider dataProvider
  24. */
  25. public function testCompareStrings($expected, $actual, $result)
  26. {
  27. $this->assertEquals($result, Security::compareStrings($expected, $actual));
  28. }
  29. /**
  30. * @return array
  31. */
  32. public function dataProvider()
  33. {
  34. return [
  35. ['a@fzsd434sdfqw24', 'a@fzsd434sdfqw24', true],
  36. ['a@fzsd4343432432drfsffe2w24', 'a@fzsd434sdfqw24', false],
  37. ['0x123', '0x123', true],
  38. [0x123, 0x123, true],
  39. ['0x123', '0x11', false],
  40. ];
  41. }
  42. }