File tree Expand file tree Collapse file tree 2 files changed +52
-26
lines changed
dev/tests/unit/testsuite/Magento/Framework/ObjectManager/Definition Expand file tree Collapse file tree 2 files changed +52
-26
lines changed Original file line number Diff line number Diff line change @@ -31,30 +31,4 @@ public function testGetParametersWithUnpacking()
31
31
$ model = new \Magento \Framework \ObjectManager \Definition \Compiled \Serialized ([$ signatures , $ definitions ]);
32
32
$ this ->assertEquals ($ checkString , $ model ->getParameters ('wonderful ' ));
33
33
}
34
-
35
- public function testGetParametersWithUndefinedDefinition ()
36
- {
37
- $ objectManager = new \Magento \TestFramework \Helper \ObjectManager ($ this );
38
- $ undefinedDefinitionSignature = new \stdClass ();
39
- $ className = 'undefinedDefinition ' ;
40
- $ readerMock = $ this ->getMock (
41
- '\Magento\Framework\Code\Reader\ClassReader ' ,
42
- ['getConstructor ' ],
43
- [],
44
- '' ,
45
- false
46
- );
47
- $ readerMock ->expects ($ this ->once ())
48
- ->method ('getConstructor ' )
49
- ->with ($ className )
50
- ->willReturn ($ undefinedDefinitionSignature );
51
- $ model = $ objectManager ->getObject (
52
- 'Magento\Framework\ObjectManager\Definition\Compiled\Serialized ' ,
53
- [
54
- 'definitions ' => [[], []],
55
- 'reader ' => $ readerMock
56
- ]
57
- );
58
- $ this ->assertEquals ($ undefinedDefinitionSignature , $ model ->getParameters ($ className ));
59
- }
60
34
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
4
+ */
5
+ namespace Magento \Framework \ObjectManager \Definition ;
6
+
7
+ class CompiledTest extends \PHPUnit_Framework_TestCase
8
+ {
9
+ public function testGetParametersWithUndefinedDefinition ()
10
+ {
11
+ $ objectManager = new \Magento \TestFramework \Helper \ObjectManager ($ this );
12
+ $ undefinedDefinitionSignature = new \stdClass ();
13
+ $ className = 'undefinedDefinition ' ;
14
+ $ readerMock = $ this ->getMock (
15
+ '\Magento\Framework\Code\Reader\ClassReader ' ,
16
+ ['getConstructor ' ],
17
+ [],
18
+ '' ,
19
+ false
20
+ );
21
+ $ readerMock ->expects ($ this ->once ())
22
+ ->method ('getConstructor ' )
23
+ ->with ($ className )
24
+ ->willReturn ($ undefinedDefinitionSignature );
25
+ $ model = $ objectManager ->getObject (
26
+ 'Magento\Framework\ObjectManager\Definition\CompiledStub ' ,
27
+ [
28
+ 'definitions ' => [[], []],
29
+ 'reader ' => $ readerMock
30
+ ]
31
+ );
32
+ $ this ->assertEquals ($ undefinedDefinitionSignature , $ model ->getParameters ($ className ));
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Stub class for abstract Magento\Framework\ObjectManager\Definition
38
+ */
39
+ class CompiledStub extends Compiled
40
+ {
41
+
42
+ /**
43
+ * Unpack signature
44
+ *
45
+ * @param string $signature
46
+ * @return mixed
47
+ */
48
+ protected function _unpack ($ signature )
49
+ {
50
+ return unserialize ($ signature );
51
+ }
52
+ }
You can’t perform that action at this time.
0 commit comments