SubstitutionTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Payment\Test\Unit\Model\Method;
  7. class SubstitutionTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
  11. */
  12. protected $objectManager;
  13. /**
  14. * @var \Magento\Payment\Model\Method\Substitution
  15. */
  16. protected $model;
  17. protected function setUp()
  18. {
  19. $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
  20. $this->model = $this->objectManager->getObject(\Magento\Payment\Model\Method\Substitution::class);
  21. }
  22. public function testGetTitle()
  23. {
  24. $infoMock = $this->getMockBuilder(
  25. \Magento\Payment\Model\Info::class
  26. )->disableOriginalConstructor()->setMethods(
  27. []
  28. )->getMock();
  29. $this->model->setInfoInstance($infoMock);
  30. $expectedResult = 'StringTitle';
  31. $infoMock->expects(
  32. $this->once()
  33. )->method(
  34. 'getAdditionalInformation'
  35. )->with(
  36. \Magento\Payment\Model\Method\Substitution::INFO_KEY_TITLE
  37. )->will(
  38. $this->returnValue(
  39. $expectedResult
  40. )
  41. );
  42. $this->assertEquals($expectedResult, $this->model->getTitle());
  43. }
  44. }