13 use PHPUnit_Framework_MockObject_MockObject as Mock;
20 private $configImporterPool;
25 private $objectManagerMock;
30 private $validatorFactoryMock;
37 $this->objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class)
38 ->getMockForAbstractClass();
39 $this->validatorFactoryMock = $this->getMockBuilder(ValidatorFactory::class)
40 ->disableOriginalConstructor()
43 $this->objectManagerMock,
44 $this->validatorFactoryMock,
46 'firstSection' => [
'importer_class' =>
'Magento\Importer\SomeImporter',
'sort_order' => 20],
48 'importer_class' =>
'Magento\Importer\SomeImporter',
49 'validator_class' =>
'Validator\SomeValidator\Class' 51 'thirdSection' => [
'importer_class' =>
'Magento\Importer\SomeImporter',
'sort_order' => 10]
62 'secondSection' =>
'Magento\Importer\SomeImporter',
63 'thirdSection' =>
'Magento\Importer\SomeImporter',
64 'firstSection' =>
'Magento\Importer\SomeImporter',
66 $this->assertSame($expectedResult, $this->configImporterPool->getImporters());
77 $this->objectManagerMock,
78 $this->validatorFactoryMock,
79 [
'wrongSection' => [
'class' =>
'']]
82 $this->configImporterPool->getImporters();
91 [
'firstSection',
'secondSection',
'thirdSection'],
92 $this->configImporterPool->getSections()
98 $validatorMock = $this->getMockBuilder(ValidatorInterface::class)
99 ->getMockForAbstractClass();
100 $this->validatorFactoryMock->expects($this->once())
102 ->with(
'Validator\SomeValidator\Class')
103 ->willReturn($validatorMock);
105 $this->assertNull($this->configImporterPool->getValidator(
'firstSection'));
106 $this->assertNull($this->configImporterPool->getValidator(
'thirdSection'));
107 $this->assertInstanceOf(
108 ValidatorInterface::class,
109 $this->configImporterPool->getValidator(
'secondSection')
testGetImportersEmptyParameterClass()