ResultTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Payment\Test\Unit\Gateway\Validator;
  7. use Magento\Payment\Gateway\Validator\Result;
  8. /**
  9. * Class ResultTest
  10. */
  11. class ResultTest extends \PHPUnit\Framework\TestCase
  12. {
  13. /** @var Result */
  14. protected $model;
  15. /**
  16. * @param $isValid mixed
  17. * @param $failsDescription array
  18. * @param $expectedIsValid mixed
  19. * @param $expectedFailsDescription array
  20. * @dataProvider resultDataProvider
  21. */
  22. public function testResult($isValid, $failsDescription, $expectedIsValid, $expectedFailsDescription)
  23. {
  24. $this->model = new Result($isValid, $failsDescription);
  25. $this->assertEquals($expectedIsValid, $this->model->isValid());
  26. $this->assertEquals($expectedFailsDescription, $this->model->getFailsDescription());
  27. }
  28. /**
  29. * @return array
  30. */
  31. public function resultDataProvider()
  32. {
  33. $phraseMock = $this->getMockBuilder(\Magento\Framework\Phrase::class)->disableOriginalConstructor()->getMock();
  34. return [
  35. [true, [$phraseMock, $phraseMock], true, [$phraseMock, $phraseMock]],
  36. ['', [], false, []],
  37. ];
  38. }
  39. }