class BasicOperationsProviderTest in Payment 8.2
@coversDefaultClass \Drupal\payment\Plugin\Payment\Method\BasicOperationsProvider
@group Payment
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\payment\Unit\Plugin\Payment\Method\BasicOperationsProviderTest
Expanded class hierarchy of BasicOperationsProviderTest
File
- tests/
src/ Unit/ Plugin/ Payment/ Method/ BasicOperationsProviderTest.php, line 17
Namespace
Drupal\Tests\payment\Unit\Plugin\Payment\MethodView source
class BasicOperationsProviderTest extends UnitTestCase {
/**
* The payment method configuration list builder.
*
* @var \Drupal\Core\Entity\EntityListBuilderInterface|\PHPUnit\Framework\MockObject\MockObject
*/
protected $paymentMethodConfigurationListBuilder;
/**
* The payment method configuration storage.
*
* @var \Drupal\Core\Entity\EntityStorageInterface|\PHPUnit\Framework\MockObject\MockObject
*/
protected $paymentMethodConfigurationStorage;
/**
* The provider under test
*
* @var \Drupal\payment\Plugin\Payment\Method\BasicOperationsProvider
*/
protected $sut;
/**
* The redirect destination.
*
* @var \Drupal\Core\Routing\RedirectDestinationInterface|\PHPUnit\Framework\MockObject\MockObject
*/
protected $redirectDestination;
/**
* The string translator.
*
* @var \Drupal\Core\StringTranslation\TranslationInterface|\PHPUnit\Framework\MockObject\MockObject
*/
protected $stringTranslation;
/**
* {@inheritdoc}
*/
public function setUp() : void {
$this->paymentMethodConfigurationListBuilder = $this
->createMock(EntityListBuilderInterface::class);
$this->paymentMethodConfigurationStorage = $this
->createMock(EntityStorageInterface::class);
$this->redirectDestination = $this
->createMock(RedirectDestinationInterface::class);
$this->stringTranslation = $this
->getStringTranslationStub();
$this->sut = new BasicOperationsProvider($this->stringTranslation, $this->redirectDestination, $this->paymentMethodConfigurationStorage, $this->paymentMethodConfigurationListBuilder);
}
/**
* @covers ::getPaymentMethodConfiguration
*/
public function testGetPaymentMethodConfiguration() {
$entity_id = $this
->randomMachineName();
$plugin_id = 'payment_basic:' . $entity_id;
$payment_method_configuration = $this
->createMock(PaymentMethodConfigurationInterface::class);
$this->paymentMethodConfigurationStorage
->expects($this
->once())
->method('load')
->with($entity_id)
->willReturn($payment_method_configuration);
$method = new \ReflectionMethod($this->sut, 'getPaymentMethodConfiguration');
$method
->setAccessible(TRUE);
$this
->assertEquals($payment_method_configuration, $method
->invoke($this->sut, $plugin_id));
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BasicOperationsProviderTest:: |
protected | property | The payment method configuration list builder. | |
BasicOperationsProviderTest:: |
protected | property | The payment method configuration storage. | |
BasicOperationsProviderTest:: |
protected | property | The redirect destination. | |
BasicOperationsProviderTest:: |
protected | property | The string translator. | |
BasicOperationsProviderTest:: |
protected | property | The provider under test | |
BasicOperationsProviderTest:: |
public | function |
Overrides UnitTestCase:: |
|
BasicOperationsProviderTest:: |
public | function | @covers ::getPaymentMethodConfiguration | |
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. |