You are here

public function PaymentTypeManagerTest::setUp in Payment 8.2

Overrides UnitTestCase::setUp

File

tests/src/Unit/Plugin/Payment/Type/PaymentTypeManagerTest.php, line 66

Class

PaymentTypeManagerTest
@coversDefaultClass \Drupal\payment\Plugin\Payment\Type\PaymentTypeManager

Namespace

Drupal\Tests\payment\Unit\Plugin\Payment\Type

Code

public function setUp() : void {
  $this->classResolver = $this
    ->createMock(ClassResolverInterface::class);
  $this->discovery = $this
    ->createMock(DiscoveryInterface::class);
  $this->factory = $this
    ->createMock(FactoryInterface::class);
  $this->moduleHandler = $this
    ->createMock(ModuleHandlerInterface::class);
  $this->cache = $this
    ->createMock(CacheBackendInterface::class);
  $namespaces = new ArrayObject();
  $this->sut = new PaymentTypeManager($namespaces, $this->cache, $this->moduleHandler, $this->classResolver);
  $property = new \ReflectionProperty($this->sut, 'discovery');
  $property
    ->setAccessible(TRUE);
  $property
    ->setValue($this->sut, $this->discovery);
  $property = new \ReflectionProperty($this->sut, 'factory');
  $property
    ->setAccessible(TRUE);
  $property
    ->setValue($this->sut, $this->factory);
}