diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index d0cf6ee8a..1aac934a1 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -588,7 +588,7 @@ class Factory $disableTls = false; if ($config && $config->get('disable-tls') === true) { if (!$warned) { - $io->write('You are running Composer with SSL/TLS protection disabled.'); + $io->writeError('You are running Composer with SSL/TLS protection disabled.'); } $warned = true; $disableTls = true; diff --git a/tests/Composer/Test/FactoryTest.php b/tests/Composer/Test/FactoryTest.php new file mode 100644 index 000000000..a6ba01565 --- /dev/null +++ b/tests/Composer/Test/FactoryTest.php @@ -0,0 +1,40 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Test; + +use PHPUnit\Framework\TestCase; +use Composer\Factory; + +class FactoryTest extends TestCase +{ + /** + * @group TLS + */ + public function testDefaultValuesAreAsExpected() + { + $ioMock = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); + + $ioMock->expects($this->once()) + ->method("writeError"); + + $config = $this + ->getMockBuilder('Composer\Config') + ->getMock(); + + $config->method('get') + ->with($this->equalTo('disable-tls')) + ->will($this->returnValue(true)); + + Factory::createRemoteFilesystem($ioMock, $config); + } +}