19 private $userContextMock;
24 private $entityManagerMock;
29 private $bulkSummaryFactoryMock;
33 $this->userContextMock = $this->createMock(\
Magento\Authorization\Model\UserContextInterface::class);
34 $this->entityManagerMock = $this->createMock(\
Magento\Framework\EntityManager\EntityManager::class);
35 $this->bulkSummaryFactoryMock = $this->createPartialMock(
36 \
Magento\AsynchronousOperations\Api\Data\BulkSummaryInterfaceFactory::class,
40 $this->model = new \Magento\AsynchronousOperations\Model\AccessValidator(
41 $this->userContextMock,
42 $this->entityManagerMock,
43 $this->bulkSummaryFactoryMock
56 $bulkSummaryMock = $this->createMock(\
Magento\AsynchronousOperations\Api\Data\BulkSummaryInterface::class);
58 $this->bulkSummaryFactoryMock->expects($this->once())->method(
'create')->willReturn($bulkSummaryMock);
59 $this->entityManagerMock->expects($this->once())
61 ->with($bulkSummaryMock, $uuid)
62 ->willReturn($bulkSummaryMock);
64 $bulkSummaryMock->expects($this->once())->method(
'getUserId')->willReturn($bulkUserId);
65 $this->userContextMock->expects($this->once())->method(
'getUserId')->willReturn($adminId);
67 $this->assertEquals($this->model->isAllowed($uuid), $expectedResult);
testIsAllowed($bulkUserId, $expectedResult)
static summaryDataProvider()