Skip to content

Commit cfc3107

Browse files
author
Andrii Kasian
committed
Merge remote-tracking branch 'mainline/develop' into bugfix
2 parents cc5798a + d1ff85c commit cfc3107

File tree

3 files changed

+31
-13
lines changed

3 files changed

+31
-13
lines changed

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ protected function getDbIsolationState(\PHPUnit_Framework_TestCase $test)
158158
* Execute single fixture script
159159
*
160160
* @param string|array $fixture
161+
* @throws \Exception
161162
*/
162163
protected function _applyOneFixture($fixture)
163164
{
@@ -168,7 +169,9 @@ protected function _applyOneFixture($fixture)
168169
require $fixture;
169170
}
170171
} catch (\Exception $e) {
171-
echo 'Error in fixture: ', json_encode($fixture), PHP_EOL, $e;
172+
throw new \Exception(
173+
sprintf("Error in fixture: %s.\n %s", json_encode($fixture), $e->getMessage())
174+
);
172175
}
173176
}
174177

@@ -180,18 +183,14 @@ protected function _applyOneFixture($fixture)
180183
*/
181184
protected function _applyFixtures(array $fixtures)
182185
{
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;
186+
/* Execute fixture scripts */
187+
foreach ($fixtures as $oneFixture) {
188+
/* Skip already applied fixtures */
189+
if (in_array($oneFixture, $this->_appliedFixtures, true)) {
190+
continue;
192191
}
193-
} catch (\PDOException $e) {
194-
echo $e;
192+
$this->_applyOneFixture($oneFixture);
193+
$this->_appliedFixtures[] = $oneFixture;
195194
}
196195
}
197196

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)