9 use Magento\Directory\Model\ResourceModel\Country\CollectionFactory;
31 private $objectManager;
39 $this->helper = $this->objectManager->getObject(Country::class, [
40 'factory' => $collectionFactory
49 $this->collection->expects(static::once())
50 ->method(
'toOptionArray')
52 [
'value' =>
'US',
'label' =>
'United States'],
53 [
'value' =>
'UK',
'label' =>
'United Kingdom'],
56 $this->helper->getCountries();
58 $this->collection->expects(static::never())
59 ->method(
'toOptionArray');
61 $this->helper->getCountries();
69 $this->collection = $this->getMockBuilder(Collection::class)
70 ->disableOriginalConstructor()
71 ->setMethods([
'addFieldToFilter',
'loadData',
'toOptionArray',
'__wakeup'])
74 $this->collection->expects(static::any())
75 ->method(
'addFieldToFilter')
78 $this->collection->expects(static::any())
82 $collectionFactory = $this->getMockBuilder(CollectionFactory::class)
83 ->disableOriginalConstructor()
84 ->setMethods([
'create'])
87 $collectionFactory->expects(static::once())
89 ->willReturn($this->collection);
91 return $collectionFactory;
getCollectionFactoryMock()