You are here

public function ValidatorTest::setUp in Telephone Validation 8.2

Overrides UnitTestCase::setUp

File

tests/src/Unit/ValidatorTest.php, line 33

Class

ValidatorTest
@coversDefaultClass Drupal\telephone_validation\Validator @group Telephone

Namespace

Drupal\Tests\telephone_validation\Unit

Code

public function setUp() {
  parent::setUp();
  $mock = $this
    ->createMock(CountryManagerInterface::class);
  $mock
    ->expects($this
    ->any())
    ->method('getList')
    ->withAnyParameters()
    ->willReturn([
    'NO' => 'Norway',
    'CA' => 'Canada',
    'US' => 'United States',
  ]);
  $this->countryManager = $mock;

  // Instantiate validator.
  $this->validator = new Validator($this->countryManager);
}