Skip to content

Commit 08d3e11

Browse files
committed
Merge branch 'MAGETWO-35920-interceptor-trait' into develop
2 parents 083a96f + 2eb3ee1 commit 08d3e11

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ protected function _generateCode()
155155
$typeName = $this->getSourceClassName();
156156
$reflection = new \ReflectionClass($typeName);
157157

158+
$interfaces = [];
158159
if ($reflection->isInterface()) {
159-
$this->_classGenerator->setImplementedInterfaces([$typeName]);
160+
$interfaces[] = $typeName;
160161
} else {
161162
$this->_classGenerator->setExtendedClass($typeName);
162163
}
163164
$this->_classGenerator->addTrait('\Magento\Framework\Interception\Interceptor');
164-
$interfaces = $this->_classGenerator->getImplementedInterfaces();
165165
$interfaces[] = '\Magento\Framework\Interception\InterceptorInterface';
166166
$this->_classGenerator->setImplementedInterfaces($interfaces);
167167
return parent::_generateCode();

lib/internal/Magento/Framework/Interception/Test/Unit/Chain/ChainTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ public function testInvokeNextBeforePlugin()
3333
$type = 'type';
3434
$method = 'method';
3535

36-
$subjectMock = $this->getMock('SubjectClass', ['___callParent']);
36+
$subjectMock = $this->getMock('Magento\Framework\Interception\InterceptorInterface');
3737
$pluginMock = $this->getMock('PluginClass', ['beforeMethod']);
3838

3939
$pluginMock->expects($this->once())
4040
->method('beforeMethod')
4141
->with($subjectMock, 1, 2)
42-
->will($this->returnValue('beforeMethodResult'));
42+
->will($this->returnValue(['beforeMethodResult']));
4343

4444
$this->_pluginListMock->expects($this->once())
4545
->method('getNext')
@@ -57,7 +57,7 @@ public function testInvokeNextBeforePlugin()
5757

5858
$subjectMock->expects($this->once())
5959
->method('___callParent')
60-
->with('method', 'beforeMethodResult')
60+
->with('method', ['beforeMethodResult'])
6161
->will($this->returnValue('subjectMethodResult'));
6262

6363
$this->assertEquals('subjectMethodResult', $this->_model->invokeNext($type, $method, $subjectMock, [1, 2]));
@@ -71,7 +71,7 @@ public function testInvokeNextAroundPlugin()
7171
$type = 'type';
7272
$method = 'method';
7373

74-
$subjectMock = $this->getMock('SubjectClass');
74+
$subjectMock = $this->getMock('Magento\Framework\Interception\InterceptorInterface');
7575
$pluginMock = $this->getMock('PluginClass', ['aroundMethod']);
7676

7777
$pluginMock->expects($this->once())
@@ -102,7 +102,7 @@ public function testInvokeNextAfterPlugin()
102102
$type = 'type';
103103
$method = 'method';
104104

105-
$subjectMock = $this->getMock('SubjectClass', ['___callParent']);
105+
$subjectMock = $this->getMock('Magento\Framework\Interception\InterceptorInterface');
106106
$pluginMock = $this->getMock('PluginClass', ['afterMethod']);
107107

108108
$pluginMock->expects($this->once())

lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/InterceptorTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
class InterceptorTest extends \PHPUnit_Framework_TestCase
1212
{
1313
/**
14-
* @var \PHPUnit_Framework_MockObject
14+
* @var \PHPUnit_Framework_MockObject_MockObject
1515
*/
1616
protected $ioObjectMock;
1717

1818
/**
19-
* @var \PHPUnit_Framework_MockObject
19+
* @var \PHPUnit_Framework_MockObject_MockObject
2020
*/
2121
protected $classGeneratorMock;
2222

@@ -46,13 +46,13 @@ public function testGetDefaultResultClassName()
4646
);
4747

4848
$this->classGeneratorMock->expects($this->once())->method('setName')
49-
->will($this->returnValue($this->classGeneratorMock));
49+
->willReturnSelf();
5050
$this->classGeneratorMock->expects($this->once())->method('addProperties')
51-
->will($this->returnValue($this->classGeneratorMock));
51+
->willReturnSelf();
5252
$this->classGeneratorMock->expects($this->once())->method('addMethods')
53-
->will($this->returnValue($this->classGeneratorMock));
53+
->willReturnSelf();
5454
$this->classGeneratorMock->expects($this->once())->method('setClassDocBlock')
55-
->will($this->returnValue($this->classGeneratorMock));
55+
->willReturnSelf();
5656
$this->classGeneratorMock->expects($this->once())->method('generate')
5757
->will($this->returnValue('source code example'));
5858
$model->expects($this->once())->method('_validateData')->will($this->returnValue(true));

0 commit comments

Comments
 (0)