| @@ 33-57 (lines=25) @@ | ||
| 30 | use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; |
|
| 31 | use Payone\Core\Helper\Country; |
|
| 32 | ||
| 33 | class KlarnaCountryTest extends \PHPUnit_Framework_TestCase |
|
| 34 | { |
|
| 35 | /** |
|
| 36 | * @var ClassToTest |
|
| 37 | */ |
|
| 38 | private $classToTest; |
|
| 39 | ||
| 40 | protected function setUp() |
|
| 41 | { |
|
| 42 | $objectManager = new ObjectManager($this); |
|
| 43 | ||
| 44 | $countryHelper = $this->getMockBuilder(Country::class)->disableOriginalConstructor()->getMock(); |
|
| 45 | $countryHelper->method('getCountryNameByIso2')->willReturn('Country Name'); |
|
| 46 | ||
| 47 | $this->classToTest = $objectManager->getObject(ClassToTest::class, [ |
|
| 48 | 'countryHelper' => $countryHelper |
|
| 49 | ]); |
|
| 50 | } |
|
| 51 | ||
| 52 | public function testToOptionArray() |
|
| 53 | { |
|
| 54 | $result = $this->classToTest->toOptionArray(); |
|
| 55 | $this->assertNotEmpty($result); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| @@ 33-57 (lines=25) @@ | ||
| 30 | use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; |
|
| 31 | use Payone\Core\Helper\Country; |
|
| 32 | ||
| 33 | class SepaCountryTest extends \PHPUnit_Framework_TestCase |
|
| 34 | { |
|
| 35 | /** |
|
| 36 | * @var ClassToTest |
|
| 37 | */ |
|
| 38 | private $classToTest; |
|
| 39 | ||
| 40 | protected function setUp() |
|
| 41 | { |
|
| 42 | $objectManager = new ObjectManager($this); |
|
| 43 | ||
| 44 | $countryHelper = $this->getMockBuilder(Country::class)->disableOriginalConstructor()->getMock(); |
|
| 45 | $countryHelper->method('getCountryNameByIso2')->willReturn('Country Name'); |
|
| 46 | ||
| 47 | $this->classToTest = $objectManager->getObject(ClassToTest::class, [ |
|
| 48 | 'countryHelper' => $countryHelper |
|
| 49 | ]); |
|
| 50 | } |
|
| 51 | ||
| 52 | public function testToOptionArray() |
|
| 53 | { |
|
| 54 | $result = $this->classToTest->toOptionArray(); |
|
| 55 | $this->assertNotEmpty($result); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||