27 public function testPaymentMethod(
$code, $methodClass)
29 if (
$code ==
'vault') {
35 \
Magento\Framework\View\Element\BlockFactory::class
38 \
Magento\Store\Model\StoreManagerInterface::class
39 )->getStore()->getId();
41 if (empty($methodClass)) {
45 $this->fail(
"Model of '{$code}' payment method is not found.");
48 if (
$code == \
Magento\Payment\Model\Method\Substitution::CODE) {
50 \
Magento\Payment\Model\Info::class
51 )->disableOriginalConstructor()->setMethods(
57 'getAdditionalInformation' 59 $this->returnValue(
'Additional data mock')
65 $this->assertNotEmpty(
$model->getTitle());
66 foreach ([
$model->getFormBlockType(),
$model->getInfoBlockType()] as $blockClass) {
67 $message =
"Block class: {$blockClass}";
69 $block = $blockFactory->createBlock($blockClass);
70 $block->setArea(
'frontend');
71 $this->assertFileExists((
string)
$block->getTemplateFile(),
$message);
72 if (
$model->canUseInternal()) {
75 \
Magento\Store\Model\StoreManagerInterface::class
77 \
Magento\Store\Model\Store::DEFAULT_STORE_ID
79 $block->setArea(
'adminhtml');
80 $this->assertFileExists((
string)
$block->getTemplateFile(),
$message);
82 \
Magento\Store\Model\StoreManagerInterface::class
86 }
catch (\Exception $e) {
88 \
Magento\Store\Model\StoreManagerInterface::class
103 public function paymentMethodDataProvider()
118 private function collectFiles(
$path)
120 $ds = preg_quote(DIRECTORY_SEPARATOR);
121 $flags = \FilesystemIterator::CURRENT_AS_FILEINFO
122 | \FilesystemIterator::SKIP_DOTS;
123 $iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator(
$path, $flags));
125 return new \RegexIterator(
127 '#' . $ds .
'etc' . $ds .
'di\.php$#',
128 \RegexIterator::MATCH,
129 \RegexIterator::USE_KEY
136 private function getTestConfiguration()
139 $ds = DIRECTORY_SEPARATOR;
140 $path =
__DIR__ . $ds . str_repeat(
'..' . $ds, 5) .
'Magento';
142 foreach ($this->collectFiles(
$path) as $file) {
143 $config = include $file->getPathname();
defined('TESTS_BP')||define('TESTS_BP' __DIR__
static getObjectManager()