public function testGetResolvedArgumentsConstructorConfiguredFormat() { $expectedResultConfigured = $this->getResolvedConfigurableConfigExpectation(); $constructor = [new ConstructorArgument(['type_dependency_configured', 'Type\\Dependency', true, null]), new ConstructorArgument(['type_dependency_shared_configured', 'Type\\Dependency\\Shared', true, null]), new ConstructorArgument(['global_argument', null, false, null]), new ConstructorArgument(['global_argument_def', null, false, []]), new ConstructorArgument(['value_configured', null, false, 'value']), new ConstructorArgument(['value_array_configured', null, false, []]), new ConstructorArgument(['value_null', null, false, null])]; $this->diContainerConfig->expects($this->any())->method('isShared')->willReturnMap([['Type\\Dependency', false], ['Type\\Dependency\\Shared', true], ['Type\\Dependency\\Configured', false], ['Type\\Dependency\\Shared\\Configured', true]]); $type = 'Class'; $this->diContainerConfig->expects($this->any())->method('getArguments')->with($type)->willReturn($this->getConfiguredArguments()); $this->assertSame($expectedResultConfigured, $this->model->getResolvedConstructorArguments($type, $constructor)); }
/** * @dataProvider getResolvedConstructorArgumentsNoSharedDataProvider */ public function testGetResolvedConstructorArgumentsNoShared($constructor, $isRequired, $getType, $isShared, $expected) { $instanceType = ['instance' => 'Magento\\Framework\\Api\\Config\\MetadataConfig', 'argument' => 'object']; $this->diContainerConfig->expects($this->any())->method('getArguments')->willReturn(['virtualType' => $instanceType]); $constructor->expects($this->any())->method('isRequired')->willReturn($isRequired); $constructor->expects($this->any())->method('getDefaultValue')->willReturn('Magento\\Customer\\Api\\Data\\Eav\\AttributeMetadataDataBuilder'); $constructor->expects($this->any())->method('getType')->willReturn($getType); $constructor->expects($this->any())->method('getName')->willReturn('virtualType'); $this->diContainerConfig->expects($this->any())->method('isShared')->willReturn($isShared); $this->assertEquals($expected, $this->model->getResolvedConstructorArguments($instanceType, [$constructor])); }