ExceptionTest.php 797 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Validator\Test\Unit;
  7. /**
  8. * Test case for \Magento\Framework\Validator\Exception
  9. */
  10. class ExceptionTest extends \PHPUnit\Framework\TestCase
  11. {
  12. /**
  13. * Testing \Magento\Framework\Validator\Exception::getMessage
  14. * @return void
  15. */
  16. public function testGetMessage()
  17. {
  18. $expectedMessage = 'error1' . PHP_EOL . 'error2' . PHP_EOL . 'error3';
  19. $messages = ['field1' => ['error1', 'error2'], 'field2' => ['error3']];
  20. $exception = new \Magento\Framework\Validator\Exception(
  21. null,
  22. null,
  23. $messages
  24. );
  25. $this->assertEquals($expectedMessage, $exception->getMessage());
  26. }
  27. }