Skip to content

Commit 98adae4

Browse files
author
Dmytro Voskoboinikov
committed
MAGETWO-35065: Integrity constraint violation produced but not caught on L2 build
1 parent 0c03986 commit 98adae4

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

dev/tests/integration/framework/Magento/TestFramework/Annotation/DataFixture.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ protected function _applyOneFixture($fixture)
168168
require $fixture;
169169
}
170170
} catch (\Exception $e) {
171-
echo 'Error in fixture: ', json_encode($fixture), PHP_EOL, $e;
171+
throw new \Exception(
172+
sprintf("Error in fixture: %s.\n %s", json_encode($fixture), $e->getMessage())
173+
);
172174
}
173175
}
174176

@@ -180,18 +182,14 @@ protected function _applyOneFixture($fixture)
180182
*/
181183
protected function _applyFixtures(array $fixtures)
182184
{
183-
try {
184-
/* Execute fixture scripts */
185-
foreach ($fixtures as $oneFixture) {
186-
/* Skip already applied fixtures */
187-
if (in_array($oneFixture, $this->_appliedFixtures, true)) {
188-
continue;
189-
}
190-
$this->_applyOneFixture($oneFixture);
191-
$this->_appliedFixtures[] = $oneFixture;
185+
/* Execute fixture scripts */
186+
foreach ($fixtures as $oneFixture) {
187+
/* Skip already applied fixtures */
188+
if (in_array($oneFixture, $this->_appliedFixtures, true)) {
189+
continue;
192190
}
193-
} catch (\PDOException $e) {
194-
echo $e;
191+
$this->_applyOneFixture($oneFixture);
192+
$this->_appliedFixtures[] = $oneFixture;
195193
}
196194
}
197195

dev/tests/integration/framework/Magento/TestFramework/Event/Transaction.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,15 @@ protected function _startTransaction(\PHPUnit_Framework_TestCase $test)
9292
if (!$this->_isTransactionActive) {
9393
$this->_getAdapter()->beginTransparentTransaction();
9494
$this->_isTransactionActive = true;
95-
$this->_eventManager->fireEvent('startTransaction', [$test]);
95+
try {
96+
$this->_eventManager->fireEvent('startTransaction', [$test]);
97+
} catch (\Exception $e) {
98+
$test->getTestResultObject()->addFailure(
99+
$test,
100+
new \PHPUnit_Framework_AssertionFailedError($e->getMessage()),
101+
0
102+
);
103+
}
96104
}
97105
}
98106

dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ protected function setUp()
3939
$this->_block->setItem($item);
4040
}
4141

42+
protected function tearDown()
43+
{
44+
/** @var $objectManager \Magento\TestFramework\ObjectManager */
45+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
46+
47+
$objectManager->removeSharedInstance('Magento\Checkout\Model\Session');
48+
$objectManager->removeSharedInstance('Magento\Checkout\Model\Session\Storage');
49+
50+
unset($_SESSION);
51+
}
52+
4253
public function testThumbnail()
4354
{
4455
$size = $this->_block->getThumbnailSize();

0 commit comments

Comments
 (0)