Skip to content

Commit

Permalink
CABPI-227: Fix unit test for AdminForgotPasswordPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianKull committed Mar 30, 2022
1 parent c5486c3 commit aeaf5c0
Showing 1 changed file with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
use Magento\AdminAdobeIms\Service\ImsConfig;
use Magento\Framework\Controller\Result\Redirect;
use Magento\Framework\Controller\Result\RedirectFactory;
use Magento\Framework\Exception\AuthenticationException;
use Magento\Framework\Exception\AuthorizationException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Message\ManagerInterface as MessageManagerInterface;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
use Magento\User\Controller\Adminhtml\Auth\Forgotpassword;
Expand Down Expand Up @@ -72,6 +69,8 @@ public function testPluginRedirectsToLoginPageWhenModuleIsEnabled(): void
{
$subject = $this->createMock(Forgotpassword::class);
$redirect = $this->createMock(Redirect::class);
$redirect->method('setPath')
->willReturnSelf();

$this->imsConfigMock
->expects($this->once())
Expand All @@ -88,11 +87,11 @@ public function testPluginRedirectsToLoginPageWhenModuleIsEnabled(): void
->with('Please sign in with Adobe ID', null)
->willReturnSelf();

$this->plugin->aroundExecute(
$subject,
function () {
}
);
$closure = function () {
return $this->createMock(Redirect::class);
};

$this->assertEquals($redirect, $this->plugin->aroundExecute($subject, $closure));
}

/**
Expand Down Expand Up @@ -120,10 +119,10 @@ public function testPluginProceedsWhenModuleIsDisabled(): void
->with('Please sign in with Adobe ID', null)
->willReturnSelf();

$this->plugin->aroundExecute(
$subject,
function () {
}
);
$closure = function () {
return $this->createMock(Redirect::class);
};

$this->assertEquals($redirect, $this->plugin->aroundExecute($subject, $closure));
}
}

0 comments on commit aeaf5c0

Please sign in to comment.