public function testToOptionArray() { $excludedCountries = $this->model->getRestrictedCountries(); $countries = [['value' => 'US', 'lable' => 'United States'], ['value' => 'countryCode', 'lable' => 'countryName']]; $this->countryCollectionMock->expects($this->once())->method('addFieldToFilter')->with('country_id', ['nin' => $excludedCountries])->willReturnSelf(); $this->countryCollectionMock->expects($this->once())->method('loadData')->willReturnSelf(); $this->countryCollectionMock->expects($this->once())->method('toOptionArray')->willReturn($countries); $header = ['value' => '', 'label' => new \Magento\Framework\Phrase('--Please Select--')]; array_unshift($countries, $header); $this->assertEquals($countries, $this->model->toOptionArray()); }