Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit c92a21b

Browse files
author
Joan He
committed
MAGETWO-83132: Move the logging to the button click action
- fix build failures
1 parent cf1eb34 commit c92a21b

File tree

2 files changed

+8
-18
lines changed
  • app/code/Magento/ReleaseNotification/Test/Unit/Controller/Notification
  • dev/tests/integration/testsuite/Magento/ReleaseNotification/Model/ResourceModel/Viewer

2 files changed

+8
-18
lines changed

app/code/Magento/ReleaseNotification/Test/Unit/Controller/Notification/MarkUserNotifiedTest.php

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ class MarkUserNotifiedTest extends \PHPUnit\Framework\TestCase
2929
*/
3030
private $storageMock;
3131

32-
/**
33-
* @var \PHPUnit_Framework_MockObject_MockObject|Context
34-
*/
35-
private $contextMock;
36-
3732
/**
3833
* @var \PHPUnit_Framework_MockObject_MockObject|Auth
3934
*/
@@ -44,11 +39,6 @@ class MarkUserNotifiedTest extends \PHPUnit\Framework\TestCase
4439
*/
4540
private $loggerMock;
4641

47-
/**
48-
* @var \PHPUnit_Framework_MockObject_MockObject|ResultFactory
49-
*/
50-
private $resultFactoryMock;
51-
5242
/**
5343
* @var \PHPUnit_Framework_MockObject_MockObject|Json
5444
*/
@@ -77,10 +67,10 @@ public function setUp()
7767
$this->authMock = $this->getMockBuilder(Auth::class)
7868
->disableOriginalConstructor()
7969
->getMock();
80-
$this->contextMock = $this->getMockBuilder(Context::class)
70+
$contextMock = $this->getMockBuilder(Context::class)
8171
->disableOriginalConstructor()
8272
->getMock();
83-
$this->contextMock->expects($this->once())
73+
$contextMock->expects($this->once())
8474
->method('getAuth')
8575
->willReturn($this->authMock);
8676
$this->productMetadataMock = $this->getMockBuilder(ProductMetadataInterface::class)
@@ -90,24 +80,24 @@ public function setUp()
9080
->getMock();
9181
$this->loggerMock = $this->getMockBuilder(LoggerInterface::class)
9282
->getMock();
93-
$this->resultFactoryMock = $this->getMockBuilder(ResultFactory::class)
83+
$resultFactoryMock = $this->getMockBuilder(ResultFactory::class)
9484
->disableOriginalConstructor()
9585
->getMock();
9686
$this->resultMock = $this->getMockBuilder(Json::class)
9787
->disableOriginalConstructor()
9888
->getMock();
99-
$this->resultFactoryMock->expects($this->once())
89+
$resultFactoryMock->expects($this->once())
10090
->method('create')
10191
->with(ResultFactory::TYPE_JSON)
10292
->willReturn($this->resultMock);
10393
$objectManagerHelper = new ObjectManagerHelper($this);
10494
$this->action = $objectManagerHelper->getObject(
10595
MarkUserNotified::class,
10696
[
107-
'resultFactory' => $this->resultFactoryMock,
97+
'resultFactory' => $resultFactoryMock,
10898
'productMetadata' => $this->productMetadataMock,
10999
'notificationLogger' => $this->notificationLoggerMock,
110-
'context' => $this->contextMock,
100+
'context' => $contextMock,
111101
'logger' => $this->loggerMock
112102
]
113103
);
@@ -126,7 +116,7 @@ public function testExecuteSuccess()
126116
->willReturn('999.999.999-alpha');
127117
$this->notificationLoggerMock->expects($this->once())
128118
->method('log')
129-
->with(1 , '999.999.999-alpha')
119+
->with(1, '999.999.999-alpha')
130120
->willReturn(true);
131121
$this->resultMock->expects($this->once())
132122
->method('setData')

dev/tests/integration/testsuite/Magento/ReleaseNotification/Model/ResourceModel/Viewer/LoggerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testLogAndGet()
3535
$userModel = Bootstrap::getObjectManager()->get(\Magento\User\Model\User::class);
3636
$adminUserNameFromFixture = 'adminUser';
3737
$adminUserId = $userModel->loadByUsername($adminUserNameFromFixture)->getId();
38-
$this->assertNull($this->logger->get($adminUserId));
38+
$this->assertEmpty($this->logger->get($adminUserId)->getId());
3939
$firstLogVersion = '2.2.2';
4040
$this->logger->log($adminUserId, $firstLogVersion);
4141
$firstLog = $this->logger->get($adminUserId);

0 commit comments

Comments
 (0)