DefaultCountryResolverTest.php in Commerce Core 8.2
File
tests/src/Unit/Resolver/DefaultCountryResolverTest.php
View source
<?php
namespace Drupal\Tests\commerce\Unit\Resolver;
use Drupal\commerce\Resolver\DefaultCountryResolver;
use Drupal\Tests\UnitTestCase;
class DefaultCountryResolverTest extends UnitTestCase {
protected $resolver;
protected function setUp() : void {
$config = $this
->getMockBuilder('Drupal\\Core\\Config\\Config')
->disableOriginalConstructor()
->getMock();
$config
->expects($this
->once())
->method('get')
->with('country.default')
->will($this
->returnValue('RS'));
$config_factory = $this
->createMock('Drupal\\Core\\Config\\ConfigFactoryInterface');
$config_factory
->expects($this
->once())
->method('get')
->with('system.date')
->will($this
->returnValue($config));
$this->resolver = new DefaultCountryResolver($config_factory);
}
public function testResolve() {
$countryCode = $this->resolver
->resolve();
$this
->assertEquals('RS', $countryCode);
}
}