Skip to content

Commit 0f54844

Browse files
committed
Fix #8315: test setup/src/Magento/Setup/Test/Unit/Module/I18n/Dictionary/Writer/Csv/StdoTest.php crashes in debug mode
- it was crashing when running PHPUnit with --debug flag due to STDOUT closing in destructor of object under test
1 parent 92d2d0d commit 0f54844

File tree

1 file changed

+6
-16
lines changed
  • setup/src/Magento/Setup/Test/Unit/Module/I18n/Dictionary/Writer/Csv

1 file changed

+6
-16
lines changed

Diff for: setup/src/Magento/Setup/Test/Unit/Module/I18n/Dictionary/Writer/Csv/StdoTest.php

+6-16
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,15 @@
55
*/
66
namespace Magento\Setup\Test\Unit\Module\I18n\Dictionary\Writer\Csv;
77

8+
use Magento\Setup\Module\I18n\Dictionary\Writer\Csv\Stdo;
9+
810
class StdoTest extends \PHPUnit_Framework_TestCase
911
{
10-
/**
11-
* @var resource
12-
*/
13-
protected $_handler;
14-
15-
protected function setUp()
16-
{
17-
$this->_handler = STDOUT;
18-
}
19-
2012
public function testThatHandlerIsRight()
2113
{
22-
$this->markTestSkipped('This is skiped as we should not close the STDO!');
23-
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
24-
/** @var \Magento\Setup\Module\I18n\Dictionary\Writer\Csv $writer */
25-
$writer = $objectManagerHelper->getObject(\Magento\Setup\Module\I18n\Dictionary\Writer\Csv\Stdo::class);
26-
27-
$this->assertAttributeEquals($this->_handler, '_fileHandler', $writer);
14+
$handler = STDOUT;
15+
// Mocking object's under test destructor here is perfectly valid as there is no way to reopen STDOUT
16+
$writer = $this->getMock(Stdo::class, ['__destruct']);
17+
$this->assertAttributeEquals($handler, '_fileHandler', $writer);
2818
}
2919
}

0 commit comments

Comments
 (0)