Skip to content

Commit 9f12628

Browse files
author
silinmykola
committed
fix after a CR
1 parent 1a7fb0c commit 9f12628

File tree

6 files changed

+14
-23
lines changed

6 files changed

+14
-23
lines changed

lib/internal/Magento/Framework/App/Test/Unit/ViewTest.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ public function testLoadLayoutWithDefaultSetup(): void
166166
$this->_layoutProcessor
167167
->method('addHandle')
168168
->withConsecutive(['default']);
169-
$this->_requestMock->expects($this->any())
170-
->method('getFullActionName')
171-
->willReturn('action_name');
169+
$this->_requestMock->method('getFullActionName')->willReturn('action_name');
172170
$this->_view->loadLayout();
173171
}
174172

@@ -177,9 +175,7 @@ public function testLoadLayoutWithDefaultSetup(): void
177175
*/
178176
public function testLoadLayoutWhenBlocksNotGenerated(): void
179177
{
180-
$this->_requestMock->expects($this->any())
181-
->method('getFullActionName')
182-
->willReturn('action_name');
178+
$this->_requestMock->method('getFullActionName')->willReturn('action_name');
183179
$this->_view->loadLayout('', false, true);
184180
}
185181

@@ -188,9 +184,7 @@ public function testLoadLayoutWhenBlocksNotGenerated(): void
188184
*/
189185
public function testLoadLayoutWhenXmlNotGenerated(): void
190186
{
191-
$this->_requestMock->expects($this->any())
192-
->method('getFullActionName')
193-
->willReturn('action_name');
187+
$this->_requestMock->method('getFullActionName')->willReturn('action_name');
194188
$this->_view->loadLayout('', true, false);
195189
}
196190

@@ -271,7 +265,10 @@ public function testGenerateLayoutBlocksWhenFlagIsSet(): void
271265
*/
272266
public function testRenderLayoutIfActionFlagExist(): void
273267
{
274-
$this->_actionFlagMock->expects($this->once())->method('get')->with('', 'no-renderLayout')->willReturn(true);
268+
$this->_actionFlagMock->expects($this->once())
269+
->method('get')
270+
->with('', 'no-renderLayout')
271+
->willReturn(true);
275272
$this->_eventManagerMock->expects($this->never())->method('dispatch');
276273
$this->_view->renderLayout();
277274
}

lib/internal/Magento/Framework/Code/Generator/EntityAbstract.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ public function getSourceClassNameWithoutNamespace()
157157
*/
158158
protected function _getFullyQualifiedClassName($className)
159159
{
160-
$className = $className ? ltrim($className, '\\') : '';
161-
return $className ? '\\' . $className : '';
160+
return $className ? '\\' . ltrim($className, '\\') : '';
162161
}
163162

164163
/**

lib/internal/Magento/Framework/Mview/Test/Unit/View/ChangelogTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ public function testGetNameWithException()
111111
{
112112
$this->expectException('DomainException');
113113
$this->expectExceptionMessage('View\'s identifier is not set');
114-
$this->model->setViewId('');
115114
$this->model->getName();
116115
}
117116

lib/internal/Magento/Framework/Mview/View/Changelog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public function getVersion()
265265
*/
266266
public function getName()
267267
{
268-
if (strlen($this->viewId) == 0) {
268+
if (!$this->viewId || strlen($this->viewId) == 0) {
269269
throw new \DomainException(
270270
new Phrase("View's identifier is not set")
271271
);

lib/internal/Magento/Framework/ObjectManager/Config/Config.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
namespace Magento\Framework\ObjectManager\Config;
77

8-
use Magento\Framework\App\ObjectManager;
98
use Magento\Framework\ObjectManager\ConfigCacheInterface;
109
use Magento\Framework\ObjectManager\DefinitionInterface;
1110
use Magento\Framework\ObjectManager\RelationsInterface;
@@ -93,7 +92,7 @@ public function __construct(
9392
) {
9493
$this->_relations = $relations ?: new \Magento\Framework\ObjectManager\Relations\Runtime();
9594
$this->_definitions = $definitions ?: new \Magento\Framework\ObjectManager\Definition\Runtime();
96-
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
95+
$this->serializer = $serializer ?: new \Magento\Framework\Serialize\Serializer\Json();
9796
}
9897

9998
/**

lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/ConfigTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,14 @@ public function testExtendWithCacheMock()
5353
$definitions = $this->getMockForAbstractClass(DefinitionInterface::class);
5454
$definitions->expects($this->once())->method('getClasses')->willReturn(['FooType']);
5555

56-
$serializer = $this->getMockForAbstractClass(SerializerInterface::class);
57-
$serializer->expects($this->any())
58-
->method('serialize')
59-
->willReturn('["custom_value"]');
6056
$cache = $this->getMockForAbstractClass(ConfigCacheInterface::class);
6157
$cache->expects($this->once())->method('get')->willReturn(false);
6258

63-
$config = new Config(null, $definitions, $serializer);
6459
$serializerMock = $this->getMockForAbstractClass(SerializerInterface::class);
65-
$serializerMock->expects($this->exactly(2))
66-
->method('serialize');
60+
$serializerMock->expects($this->atLeast(2))
61+
->method('serialize')
62+
->willReturn('[[],[],[],[]]');
63+
$config = new Config(null, $definitions, $serializerMock);
6764
$this->objectManagerHelper->setBackwardCompatibleProperty(
6865
$config,
6966
'serializer',

0 commit comments

Comments
 (0)