Ensure that a missing SSL/TLS protection warning does not pollute STDOUT
Fixes #7737pull/7641/head^2
parent
67e6d6d8a4
commit
20107dbf77
|
@ -588,7 +588,7 @@ class Factory
|
||||||
$disableTls = false;
|
$disableTls = false;
|
||||||
if ($config && $config->get('disable-tls') === true) {
|
if ($config && $config->get('disable-tls') === true) {
|
||||||
if (!$warned) {
|
if (!$warned) {
|
||||||
$io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
|
$io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
|
||||||
}
|
}
|
||||||
$warned = true;
|
$warned = true;
|
||||||
$disableTls = true;
|
$disableTls = true;
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue