File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
lib/internal/Magento/Framework/Interception/Test/Unit/ObjectManager/Config Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -58,4 +58,23 @@ public function testGetOriginalInstanceTypeReturnsInterceptedClass()
58
58
$ this ->assertEquals ('SomeClass\Interceptor ' , $ this ->model ->getInstanceType ('SomeClass ' ));
59
59
$ this ->assertEquals ('SomeClass ' , $ this ->model ->getOriginalInstanceType ('SomeClass ' ));
60
60
}
61
+
62
+ /**
63
+ * Test correct instance type is returned when plugins are created for virtual type parents
64
+ *
65
+ * @return void
66
+ */
67
+ public function testGetInstanceTypeWithPluginOnVirtualTypeParent () : void
68
+ {
69
+ $ reflectionClass = new \ReflectionClass (get_class ($ this ->model ));
70
+ $ reflectionProperty = $ reflectionClass ->getProperty ('_virtualTypes ' );
71
+ $ reflectionProperty ->setAccessible (true );
72
+ $ reflectionProperty ->setValue ($ this ->model , ['SomeVirtualClass ' => 'SomeClass ' ]);
73
+
74
+ $ this ->interceptionConfig ->expects ($ this ->once ())->method ('hasPlugins ' )->with ('SomeClass ' )->willReturn (true );
75
+ $ this ->model ->setInterceptionConfig ($ this ->interceptionConfig );
76
+
77
+ $ instanceType = $ this ->model ->getInstanceType ('SomeVirtualClass ' );
78
+ $ this ->assertEquals ('SomeClass\Interceptor ' , $ instanceType );
79
+ }
61
80
}
You can’t perform that action at this time.
0 commit comments