You are here

public function PaymentStatusManagerTest::setUp in Payment 8.2

Overrides UnitTestCase::setUp

File

tests/src/Unit/Plugin/Payment/Status/PaymentStatusManagerTest.php, line 74

Class

PaymentStatusManagerTest
@coversDefaultClass \Drupal\payment\Plugin\Payment\Status\PaymentStatusManager

Namespace

Drupal\Tests\payment\Unit\Plugin\Payment\Status

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->moduleHandler
    ->expects($this
    ->atLeastOnce())
    ->method('getModuleDirectories')
    ->willReturn([]);
  $this->cache = $this
    ->createMock(CacheBackendInterface::class);
  $this->stringTranslation = $this
    ->getStringTranslationStub();
  $this->sut = new PaymentStatusManager($this->cache, $this->moduleHandler, $this->classResolver, $this->stringTranslation);
  $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);
}