You are here

public function PaymentMethodConfigurationManagerTest::setUp in Payment 8.2

Overrides UnitTestCase::setUp

File

tests/src/Unit/Plugin/Payment/MethodConfiguration/PaymentMethodConfigurationManagerTest.php, line 58

Class

PaymentMethodConfigurationManagerTest
@coversDefaultClass \Drupal\payment\Plugin\Payment\MethodConfiguration\PaymentMethodConfigurationManager

Namespace

Drupal\Tests\payment\Unit\Plugin\Payment\MethodConfiguration

Code

public function setUp() : void {
  $this->discovery = $this
    ->createMock(DiscoveryInterface::class);
  $this->factory = $this
    ->getMockBuilder(FactoryInterface::class)
    ->disableOriginalConstructor()
    ->getMock();
  $this->moduleHandler = $this
    ->createMock(ModuleHandlerInterface::class);
  $this->cache = $this
    ->createMock(CacheBackendInterface::class);
  $namespaces = new ArrayObject();
  $this->sut = new PaymentMethodConfigurationManager($namespaces, $this->cache, $this->moduleHandler);
  $discovery_property = new \ReflectionProperty($this->sut, 'discovery');
  $discovery_property
    ->setAccessible(TRUE);
  $discovery_property
    ->setValue($this->sut, $this->discovery);
  $factory_property = new \ReflectionProperty($this->sut, 'factory');
  $factory_property
    ->setAccessible(TRUE);
  $factory_property
    ->setValue($this->sut, $this->factory);
}