Skip to content

Commit

Permalink
Fix #8315: test setup/src/Magento/Setup/Test/Unit/Module/I18n/Diction…
Browse files Browse the repository at this point in the history
…ary/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
  • Loading branch information
orlangur committed Feb 20, 2017
1 parent 92d2d0d commit 0f54844
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,15 @@
*/
namespace Magento\Setup\Test\Unit\Module\I18n\Dictionary\Writer\Csv;

use Magento\Setup\Module\I18n\Dictionary\Writer\Csv\Stdo;

class StdoTest extends \PHPUnit_Framework_TestCase
{
/**
* @var resource
*/
protected $_handler;

protected function setUp()
{
$this->_handler = STDOUT;
}

public function testThatHandlerIsRight()
{
$this->markTestSkipped('This is skiped as we should not close the STDO!');
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
/** @var \Magento\Setup\Module\I18n\Dictionary\Writer\Csv $writer */
$writer = $objectManagerHelper->getObject(\Magento\Setup\Module\I18n\Dictionary\Writer\Csv\Stdo::class);

$this->assertAttributeEquals($this->_handler, '_fileHandler', $writer);
$handler = STDOUT;
// Mocking object's under test destructor here is perfectly valid as there is no way to reopen STDOUT
$writer = $this->getMock(Stdo::class, ['__destruct']);
$this->assertAttributeEquals($handler, '_fileHandler', $writer);
}
}

0 comments on commit 0f54844

Please sign in to comment.