PaymentFoundTest.php in Commerce Migrate 3.0.x
File
modules/ubercart/tests/src/Kernel/PaymentFoundTest.php
View source
<?php
namespace Drupal\Tests\commerce_migrate_ubercart\Kernel;
use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
class PaymentFoundTest extends MigrateDrupalTestBase {
public static $modules = [
'commerce_migrate_ubercart',
];
protected $paymentMigrations = [
'uc_payment_gateway',
'uc6_payment',
];
public function testPaymentMigrationsFound() {
$this
->enableModules([
'commerce_price',
'commerce',
]);
$plugin_manager = $this->container
->get('plugin.manager.migration');
foreach ($this->paymentMigrations as $payment_migration) {
$definition = $plugin_manager
->getDefinition($payment_migration);
$migration = $plugin_manager
->createInstance($payment_migration, $definition);
$this
->assertNotNull($migration, "Payment migration " . $payment_migration . " not found");
}
}
public function testPaymentMigrationsNotFound() {
$plugin_manager = $this->container
->get('plugin.manager.migration');
foreach ($this->paymentMigrations as $payment_migration) {
$this
->expectException(PluginNotFoundException::class);
$this
->expectExceptionMessage('The "' . $payment_migration . '" plugin does not exist.');
$plugin_manager
->getDefinition($payment_migration);
}
}
}