/** * Render block HTML * * @return string */ protected function _toHtml() { if (!$this->getOptions()) { $this->setOptions($this->countryHelper->getCountries()); } return parent::_toHtml(); }
/** * @covers \Magento\Braintree\Helper\Country::getCountries */ public function testGetCountries() { $this->collection->expects(static::once())->method('toOptionArray')->willReturn([['value' => 'US', 'label' => 'United States'], ['value' => 'UK', 'label' => 'United Kingdom']]); $this->helper->getCountries(); $this->collection->expects(static::never())->method('toOptionArray'); $this->helper->getCountries(); }