CredentialsValidatorTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Customer\Test\Unit\Model\Customer;
  7. use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
  8. class CredentialsValidatorTest extends \PHPUnit\Framework\TestCase
  9. {
  10. /**
  11. * @var ObjectManagerHelper
  12. */
  13. private $objectManagerHelper;
  14. /**
  15. * @var \Magento\Customer\Model\Customer\CredentialsValidator
  16. */
  17. private $object;
  18. protected function setUp()
  19. {
  20. $this->objectManagerHelper = new ObjectManagerHelper($this);
  21. $this->object = $this->objectManagerHelper
  22. ->getObject(\Magento\Customer\Model\Customer\CredentialsValidator::class);
  23. }
  24. /**
  25. * @expectedException \Magento\Framework\Exception\InputException
  26. */
  27. public function testCheckPasswordDifferentFromEmail()
  28. {
  29. $email = 'test1@example.com';
  30. $password = strtoupper($email); // for case-insensitive check
  31. $this->object->checkPasswordDifferentFromEmail($email, $password);
  32. $this->expectExceptionMessage(
  33. "The password can't be the same as the email address. Create a new password and try again."
  34. );
  35. }
  36. }