32 private $lockerProcess;
37 private $filesystemMock;
51 $this->filesystemMock = $this->getMockBuilder(\
Magento\Framework\Filesystem::class)
52 ->disableOriginalConstructor()
54 $this->stateMock = $this->getMockBuilder(State::class)
55 ->disableOriginalConstructor()
61 'filesystem' => $this->filesystemMock,
62 'state' => $this->stateMock,
77 $this->filesystemMock->expects(self::once())
78 ->method(
'getDirectoryWrite')
82 $this->lockerProcess->lockProcess(self::LOCK_NAME);
88 $this->filesystemMock->expects($this->never())->method(
'getDirectoryWrite');
90 $this->lockerProcess->lockProcess(self::LOCK_NAME);
99 $this->filesystemMock->expects(self::once())
100 ->method(
'getDirectoryWrite')
104 $this->lockerProcess->lockProcess(self::LOCK_NAME);
105 $this->lockerProcess->unlockProcess();
111 $this->filesystemMock->expects(self::never())->method(
'getDirectoryWrite');
113 $this->lockerProcess->lockProcess(self::LOCK_NAME);
114 $this->lockerProcess->unlockProcess();
123 [
'method' =>
'getTmpDirectoryMockTrue'],
124 [
'method' =>
'getTmpDirectoryMockFalse']
133 $tmpDirectoryMock = $this->getTmpDirectoryMock();
135 $tmpDirectoryMock->expects(self::atLeastOnce())
137 ->with($this->fileName)
140 $tmpDirectoryMock->expects(self::atLeastOnce())
142 ->with($this->fileName)
143 ->willReturn(
time() - 25);
145 $tmpDirectoryMock->expects(self::once())
146 ->method(
'writeFile')
147 ->with($this->fileName, self::matchesRegularExpression(
'#\d+#'));
149 return $tmpDirectoryMock;
158 $tmpDirectoryMock = $this->getTmpDirectoryMock();
160 $tmpDirectoryMock->expects(self::atLeastOnce())
162 ->with($this->fileName)
165 $tmpDirectoryMock->expects(self::never())
166 ->method(
'readFile');
168 $tmpDirectoryMock->expects(self::exactly($exactly))
170 ->with($this->fileName);
172 $tmpDirectoryMock->expects(self::once())
173 ->method(
'writeFile')
174 ->with($this->fileName, self::matchesRegularExpression(
'#\d+#'));
176 return $tmpDirectoryMock;
182 private function getTmpDirectoryMock()
184 $tmpDirectoryMock = $this->getMockBuilder(\
Magento\Framework\
Filesystem\Directory\WriteInterface::class)
185 ->getMockForAbstractClass();
187 return $tmpDirectoryMock;
testNotUnlockProcessInProductionMode()
testNotLockProcessInProductionMode()
dataProviderTestLockProcess()
getTmpDirectoryMockFalse($exactly=0)
getTmpDirectoryMockTrue()