Skip to content

Commit 24e0ae2

Browse files
committed
MC-31920: Let Magento\Framework\Lock\Backend\Database have 2 locks in single connection
- Update unit test with correct assertions;
1 parent ed95703 commit 24e0ae2

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/internal/Magento/Framework/Lock/Test/Unit/Backend/DatabaseTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Magento\Framework\App\DeploymentConfig;
1111
use Magento\Framework\App\ResourceConnection;
1212
use Magento\Framework\DB\Adapter\AdapterInterface;
13-
use Magento\Framework\Exception\AlreadyExistsException;
1413
use Magento\Framework\Lock\Backend\Database;
1514
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1615
use PHPUnit\Framework\MockObject\MockObject;
@@ -90,7 +89,6 @@ protected function setUp(): void
9089
}
9190

9291
/**
93-
* @throws AlreadyExistsException
9492
* @throws \Zend_Db_Statement_Exception
9593
*/
9694
public function testLock()
@@ -107,7 +105,6 @@ public function testLock()
107105
}
108106

109107
/**
110-
* @throws AlreadyExistsException
111108
* @throws \Zend_Db_Statement_Exception
112109
*/
113110
public function testlockWithTooLongName()
@@ -124,12 +121,10 @@ public function testlockWithTooLongName()
124121
}
125122

126123
/**
127-
* @throws AlreadyExistsException
128124
* @throws \Zend_Db_Statement_Exception
129125
*/
130126
public function testlockWithAlreadyAcquiredLockInSameSession()
131127
{
132-
$this->expectException('Magento\Framework\Exception\AlreadyExistsException');
133128
$this->deploymentConfig
134129
->method('isDbAvailable')
135130
->with()
@@ -138,12 +133,11 @@ public function testlockWithAlreadyAcquiredLockInSameSession()
138133
->method('fetchColumn')
139134
->willReturn(true);
140135

141-
$this->database->lock('testLock');
142-
$this->database->lock('differentLock');
136+
$this->assertTrue($this->database->lock('testLock'));
137+
$this->assertTrue($this->database->lock('differentLock'));
143138
}
144139

145140
/**
146-
* @throws AlreadyExistsException
147141
* @throws \Zend_Db_Statement_Exception
148142
*/
149143
public function testLockWithUnavailableDeploymentConfig()

0 commit comments

Comments
 (0)