class PaymentTest in Payment 8.2
Same name in this branch
- 8.2 tests/src/Unit/PaymentTest.php \Drupal\Tests\payment\Unit\PaymentTest
- 8.2 tests/src/Functional/Controller/PaymentTest.php \Drupal\Tests\payment\Functional\Controller\PaymentTest
- 8.2 modules/payment_test/src/Plugin/Payment/Type/PaymentTest.php \Drupal\payment_test\Plugin\Payment\Type\PaymentTest
@coversDefaultClass \Drupal\payment\Payment
@group Payment
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\payment\Unit\PaymentTest
Expanded class hierarchy of PaymentTest
File
- tests/
src/ Unit/ PaymentTest.php, line 19
Namespace
Drupal\Tests\payment\UnitView source
class PaymentTest extends UnitTestCase {
/**
* The host site's container.
*/
protected $originalContainer;
/**
* {@inheritdoc}
*/
public function tearDown() {
\Drupal::unsetContainer();
}
/**
* @covers ::lineItemManager
*/
public function testLineItemManager() {
$container = new Container();
$line_item_manager = $this
->createMock(PaymentLineItemManagerInterface::class);
$container
->set('plugin.manager.payment.line_item', $line_item_manager);
\Drupal::setContainer($container);
$this
->assertSame($line_item_manager, Payment::lineItemManager());
}
/**
* @covers ::methodManager
*/
public function testMethodManager() {
$container = new Container();
$method_manager = $this
->createMock(PaymentMethodManagerInterface::class);
$container
->set('plugin.manager.payment.method', $method_manager);
\Drupal::setContainer($container);
$this
->assertSame($method_manager, Payment::methodManager());
}
/**
* @covers ::methodConfigurationManager
*/
public function testMethodConfigurationManager() {
$container = new Container();
$method_configuration_manager = $this
->createMock(PaymentMethodConfigurationManagerInterface::class);
$container
->set('plugin.manager.payment.method_configuration', $method_configuration_manager);
\Drupal::setContainer($container);
$this
->assertSame($method_configuration_manager, Payment::methodConfigurationManager());
}
/**
* @covers ::statusManager
*/
public function testStatusManager() {
$container = new Container();
$status_manager = $this
->createMock(PaymentStatusManagerInterface::class);
$container
->set('plugin.manager.payment.status', $status_manager);
\Drupal::setContainer($container);
$this
->assertSame($status_manager, Payment::statusManager());
}
/**
* @covers ::typeManager
*/
public function testTypeManager() {
$container = new Container();
$type_manager = $this
->createMock(PaymentTypeManagerInterface::class);
$container
->set('plugin.manager.payment.type', $type_manager);
\Drupal::setContainer($container);
$this
->assertSame($type_manager, Payment::typeManager());
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PaymentTest:: |
protected | property | The host site's container. | |
PaymentTest:: |
public | function | ||
PaymentTest:: |
public | function | @covers ::lineItemManager | |
PaymentTest:: |
public | function | @covers ::methodConfigurationManager | |
PaymentTest:: |
public | function | @covers ::methodManager | |
PaymentTest:: |
public | function | @covers ::statusManager | |
PaymentTest:: |
public | function | @covers ::typeManager | |
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. | |
UnitTestCase:: |
protected | function | 340 |